Example usage for java.time OffsetDateTime MIN

List of usage examples for java.time OffsetDateTime MIN

Introduction

In this page you can find the example usage for java.time OffsetDateTime MIN.

Prototype

OffsetDateTime MIN

To view the source code for java.time OffsetDateTime MIN.

Click Source Link

Document

The minimum supported OffsetDateTime , '-999999999-01-01T00:00:00+18:00'.

Usage

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.MIN;

    System.out.println(o);
}

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.MAX;

    System.out.println(o.equals(OffsetDateTime.MIN));
}

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.MAX;

    System.out.println(o.isEqual(OffsetDateTime.MIN));
}

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.MAX;

    System.out.println(o.isAfter(OffsetDateTime.MIN));
}

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.MAX;

    System.out.println(o.isBefore(OffsetDateTime.MIN));
}

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.MAX;

    System.out.println(o.compareTo(OffsetDateTime.MIN));
}

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  va 2 s .  c o m
 * @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.// ww  w . j  a  v a  2s .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 starts at the the minimum supported date/datetime in Java?
 * @return true if this period starts at the minimum date/datetime supported by Java.
 * False otherwise./* ww  w . j  a  v  a  2 s.  c om*/
 * @see LocalDate#MIN for the minimum supported date.
 * @see OffsetDateTime#MIN for the maximum supported date.
 */
public boolean startsAtMinDate() {
    return startDateTime.withOffsetSameInstant(OffsetDateTime.MIN.getOffset()).equals(OffsetDateTime.MIN);
}

From source file:org.silverpeas.core.date.Period.java

private static OffsetDateTime minOrDateTime(final Temporal dateTime) {
    return dateTime == null ? OffsetDateTime.MIN : asOffsetDateTime(dateTime);
}