List of usage examples for java.time OffsetDateTime MAX
OffsetDateTime MAX
To view the source code for java.time OffsetDateTime MAX.
Click Source Link
From source file:Main.java
public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.MAX; OffsetTime of = o.toOffsetTime(); System.out.println(of); }
From source file:Main.java
public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.MAX; ZonedDateTime z = o.toZonedDateTime(); System.out.println(z); }
From source file:org.silverpeas.core.date.Period.java
/** * Creates a new period of time between the two non null specified dates. The period is spreading * over all the day(s) between the specified inclusive start day and the exclusive end day; the * period is expressed in days. For example, a period between 2016-12-15 and 2016-12-17 means the * period is spreading over two days (2016-12-15 and 2016-12-16). * @param startDay the start day of the period. It defines the inclusive date at which the * period starts./*from w w w.j a v a 2s .com*/ * @param endDay the end day of the period. It defines the exclusive date at which the period * ends. The end date must be the same or after the start date. An end date equal to the start * date means the period is spanning all the day of the start date; it is equivalent to an end * date being one day after the start date. * @return the period of days between the two specified dates. */ public static Period between(LocalDate startDay, LocalDate endDay) { checkPeriod(startDay, endDay); Period period = new Period(); period.startDateTime = startDay == LocalDate.MIN ? OffsetDateTime.MIN : startDay.atStartOfDay(ZoneOffset.UTC).toOffsetDateTime(); period.endDateTime = endDay == LocalDate.MAX ? OffsetDateTime.MAX : endDay.atStartOfDay(ZoneOffset.UTC).toOffsetDateTime(); if (startDay.isEqual(endDay)) { period.endDateTime = period.endDateTime.plusDays(1); } period.inDays = true; return period; }
From source file:org.silverpeas.core.date.Period.java
/** * Creates a new period of time between the two non null specified datetime. The period starts at * the specified inclusive datetime and it ends at the specified other exclusive datetime. For * example, a period between 2016-12-17T13:30:00Z and 2016-12-17T14:30:00Z means the period is * spanning one hour the December 12.//from www . j a va 2 s. c o m * @param startDateTime the start datetime of the period. It defines the inclusive date * time at which the period starts. * @param endDateTime the end datetime of the period. It defines the exclusive datetime * at which the period ends. The end datetime must be after the start datetime. * @return the period of time between the two specified datetimes. */ public static Period between(OffsetDateTime startDateTime, OffsetDateTime endDateTime) { checkPeriod(startDateTime, endDateTime); Period period = new Period(); period.startDateTime = startDateTime == OffsetDateTime.MIN ? OffsetDateTime.MIN : startDateTime.withOffsetSameInstant(ZoneOffset.UTC); period.endDateTime = endDateTime == OffsetDateTime.MAX ? OffsetDateTime.MAX : endDateTime.withOffsetSameInstant(ZoneOffset.UTC); period.inDays = false; return period; }
From source file:org.silverpeas.core.date.Period.java
/** * Is this period ends at the the maximum supported date/datetime in Java? * @return true if this period ends at the minimum date/datetime supported by Java. * False otherwise./* ww w.ja v a 2 s . co m*/ * @see LocalDate#MAX for the maximum supported datetime. * @see OffsetDateTime#MAX for the maximum supported datetime. */ public boolean endsAtMaxDate() { return endDateTime.withOffsetSameInstant(OffsetDateTime.MAX.getOffset()).equals(OffsetDateTime.MAX); }
From source file:org.silverpeas.core.date.Period.java
private static OffsetDateTime maxOrDateTime(final Temporal dateTime) { return dateTime == null ? OffsetDateTime.MAX : asOffsetDateTime(dateTime); }