cesiumlanguagewriter.YearMonthDay.daysInMonth()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中cesiumlanguagewriter.YearMonthDay.daysInMonth()方法的一些代码示例,展示了YearMonthDay.daysInMonth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonthDay.daysInMonth()方法的具体详情如下:
包路径:cesiumlanguagewriter.YearMonthDay
类名称:YearMonthDay
方法名:daysInMonth

YearMonthDay.daysInMonth介绍

[英]Provides the number of days in the month of the indicated year.
[中]提供指定年份当月的天数。

代码示例

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. *
  3. Indicates whether the year, month, and day are a valid representation.
  4. * @param year The year.
  5. * @param month The month of the year (in the range 1 through 12)
  6. * @param day The day of the month (in the range 1 through the number of days in
  7. {@code month})
  8. * @return {@code true} if the representation is valid and
  9. {@code false} if it is not.
  10. */
  11. public static boolean isValidDate(int year, int month, int day) {
  12. return year >= 1 && year <= 9999 && month >= 1 && month <= 12 && day >= 1 && day <= daysInMonth(year, month);
  13. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. public final void testDaysInMonth() {
  2. for (int i = 1; i < 10000; ++i) {
  3. Assert.assertEquals((int) 31, (int) YearMonthDay.daysInMonth(i, 1));
  4. Assert.assertEquals((int) 29, (int) YearMonthDay.daysInMonth(i, 2));
  5. Assert.assertEquals((int) 28, (int) YearMonthDay.daysInMonth(i, 2));
  6. Assert.assertEquals((int) 31, (int) YearMonthDay.daysInMonth(i, 3));
  7. Assert.assertEquals((int) 30, (int) YearMonthDay.daysInMonth(i, 4));
  8. Assert.assertEquals((int) 31, (int) YearMonthDay.daysInMonth(i, 5));
  9. Assert.assertEquals((int) 30, (int) YearMonthDay.daysInMonth(i, 6));
  10. Assert.assertEquals((int) 31, (int) YearMonthDay.daysInMonth(i, 7));
  11. Assert.assertEquals((int) 31, (int) YearMonthDay.daysInMonth(i, 8));
  12. Assert.assertEquals((int) 30, (int) YearMonthDay.daysInMonth(i, 9));
  13. Assert.assertEquals((int) 31, (int) YearMonthDay.daysInMonth(i, 10));
  14. Assert.assertEquals((int) 30, (int) YearMonthDay.daysInMonth(i, 11));
  15. Assert.assertEquals((int) 31, (int) YearMonthDay.daysInMonth(i, 12));

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. Assert.assertEquals((int) month, (int) ymd.getMonth());
  2. Assert.assertEquals((int) 1, (int) ymd.getDay());
  3. int daysInMonth = YearMonthDay.daysInMonth(year, month);

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. Assert.assertFalse(YearMonthDay.isValidDate(2000, 13, 1));
  2. for (int month = 1; month < 13; ++month) {
  3. int daysInMonth = YearMonthDay.daysInMonth(2000, month);
  4. Assert.assertFalse(YearMonthDay.isValidDate(2000, month, 0));
  5. for (int day = 1; day < daysInMonth + 1; ++day) {

相关文章