gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-17 22:52:40 30 4
gpt4 key购买 nike

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

Year.atMonthDay介绍

[英]Combines this year with a month-day to create a LocalDate.

This returns a LocalDate formed from this year and the specified month-day.

A month-day of February 29th will be adjusted to February 28th in the resulting date if the year is not a leap year.
[中]将今年与一个月的一天结合起来创建一个LocalDate。
这将返回从今年到指定月份的LocalDate。
如果年份不是闰年,则2月29日的一个月将调整为结果日期中的2月28日。

代码示例

代码示例来源:origin: com.thoughtworks.xstream/xstream

final MonthDay md = MonthDay.from(ta);
  final OffsetTime ot = OffsetTime.from(ta);
  return GregorianCalendar.from(ot.atDate(y.atMonthDay(md)).atZoneSameInstant(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {
  final MonthDay md = MonthDay.from(ta);
  final OffsetTime ot = OffsetTime.from(ta);
  return GregorianCalendar.from(ot.atDate(y.atMonthDay(md)).atZoneSameInstant(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {
  final Year y = Year.from(ta);
  final MonthDay md = MonthDay.from(ta);
  return GregorianCalendar.from(y.atMonthDay(md).atStartOfDay(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {

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

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

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

/**
 * Returns a {@link java.time.LocalDate} of this year on the given {@link java.time.MonthDay}.
 *
 * @param self     a Year
 * @param monthDay a MonthDay
 * @return a LocalDate
 * @since 2.5.0
 */
public static LocalDate leftShift(final Year self, MonthDay monthDay) {
  return self.atMonthDay(monthDay);
}

代码示例来源:origin: org.simpleflatmapper/sfm-converter

@Override
  public Date convert(Year in, Context context) throws Exception {
    if (in == null) return null;
    return Date.from(in.atMonthDay(MonthDay.of(Month.JANUARY, 1)).atStartOfDay(zoneId).toInstant());
  }
}

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

@Override
  public Date convert(Year in, Context context) throws Exception {
    if (in == null) return null;
    return Date.from(in.atMonthDay(MonthDay.of(Month.JANUARY, 1)).atStartOfDay(zoneId).toInstant());
  }
}

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

@Test
public void testJavaYear() throws Exception {
  java.time.Year value = java.time.Year.now();
  java.time.ZoneId zoneId = ZoneId.of("America/Los_Angeles");
  newFieldMapperAndMapToPS(new ConstantGetter<Object, java.time.Year>(value),  java.time.Year.class, new JavaZoneIdProperty(zoneId));
  newFieldMapperAndMapToPS(NullGetter.<Object,  java.time.Year>getter(), java.time.Year.class);
  verify(ps).setDate(1, new java.sql.Date(value.atMonthDay(MonthDay.of(Month.JANUARY, 1)).atStartOfDay(zoneId).toInstant().toEpochMilli()));
  verify(ps).setNull(2, Types.DATE);
}
//IFJAVA8_END

代码示例来源:origin: x-stream/xstream

final MonthDay md = MonthDay.from(ta);
  final OffsetTime ot = OffsetTime.from(ta);
  return GregorianCalendar.from(ot.atDate(y.atMonthDay(md)).atZoneSameInstant(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {
  final MonthDay md = MonthDay.from(ta);
  final OffsetTime ot = OffsetTime.from(ta);
  return GregorianCalendar.from(ot.atDate(y.atMonthDay(md)).atZoneSameInstant(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {
  final Year y = Year.from(ta);
  final MonthDay md = MonthDay.from(ta);
  return GregorianCalendar.from(y.atMonthDay(md).atStartOfDay(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8

final MonthDay md = MonthDay.from(ta);
  final OffsetTime ot = OffsetTime.from(ta);
  return GregorianCalendar.from(ot.atDate(y.atMonthDay(md)).atZoneSameInstant(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {
  final MonthDay md = MonthDay.from(ta);
  final OffsetTime ot = OffsetTime.from(ta);
  return GregorianCalendar.from(ot.atDate(y.atMonthDay(md)).atZoneSameInstant(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {
  final Year y = Year.from(ta);
  final MonthDay md = MonthDay.from(ta);
  return GregorianCalendar.from(y.atMonthDay(md).atStartOfDay(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {

代码示例来源:origin: apache/servicemix-bundles

final MonthDay md = MonthDay.from(ta);
  final OffsetTime ot = OffsetTime.from(ta);
  return GregorianCalendar.from(ot.atDate(y.atMonthDay(md)).atZoneSameInstant(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {
  final MonthDay md = MonthDay.from(ta);
  final OffsetTime ot = OffsetTime.from(ta);
  return GregorianCalendar.from(ot.atDate(y.atMonthDay(md)).atZoneSameInstant(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {
  final Year y = Year.from(ta);
  final MonthDay md = MonthDay.from(ta);
  return GregorianCalendar.from(y.atMonthDay(md).atStartOfDay(ZoneId.systemDefault()));
} catch (final DateTimeParseException e) {

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