gpt4 book ai didi

java.time.Year.atMonth()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 21:44:40 28 4
gpt4 key购买 nike

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

Year.atMonth介绍

[英]Combines this year with a month to create a YearMonth.

This returns a YearMonth formed from this year and the specified month. All possible combinations of year and month are valid.

This method can be used as part of a chain to produce a date:

LocalDate date = year.atMonth(month).atDay(day);

[中]将今年与月份合并以创建YearMonth。
这将返回从今年到指定月份形成的YearMonth。年和月的所有可能组合都有效。
此方法可作为链的一部分用于生成日期:

LocalDate date = year.atMonth(month).atDay(day);

代码示例

代码示例来源:origin: org.codehaus.groovy/groovy-datetime

/**
 * Returns a {@link java.time.YearMonth} of this year and the provided {@link java.time.Month}.
 *
 * @param self  a Year
 * @param month a Month
 * @return a YearMonth
 * @since 2.5.0
 */
public static YearMonth leftShift(final Year self, Month month) {
  return self.atMonth(month);
}

代码示例来源:origin: org.codehaus.groovy/groovy-datetime

/**
 * Converts the Calendar to a corresponding {@link java.time.YearMonth}. If the Calendar has a different
 * time zone than the system default, the YearMonth will be adjusted into the default time zone.
 *
 * @param self a Calendar
 * @return a YearMonth
 * @since 2.5.0
 */
public static YearMonth toYearMonth(final Calendar self) {
  return toYear(self).atMonth(toMonth(self));
}

代码示例来源:origin: stackoverflow.com

return year.atMonth(month)
    .atDay(1)
    .atStartOfDay()
return year.atMonth(month)
    .atEndOfMonth()
    .atTime(LocalTime.MAX)

代码示例来源:origin: Silverpeas/Silverpeas-Core

/**
 * Gets a window of time on this calendar defined by the specified period. The window of time
 * will include only the events in this calendar that occur in the specified period.
 * @param year the year during which the events in this calendar occur.
 * @return the window of time including the events in this calendar occurring in the given period.
 */
public CalendarTimeWindow in(final Year year) {
 return between(year.atDay(1), year.atMonth(DECEMBER).atEndOfMonth());
}

代码示例来源:origin: arnaudroger/SimpleFlatMapper

@Test
public void testObjectToYear() throws Exception {
  ZoneId zoneId = ZoneId.systemDefault();
  Date now = new Date();
  Year year = Year.from(now.toInstant().atZone(zoneId));
  testObjectToYear(null, null);
  testObjectToYear(year, year);
  testObjectToYear(year.atMonth(6).atEndOfMonth().atTime(1, 0).atZone(zoneId), year);
  testObjectToYear(now, year);
  testObjectToYear(year.getValue(), year);
  try {
    testObjectToYear("a string", year);
    fail();
  } catch (IllegalArgumentException e) {
    // expected
  }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com