Class ZonedDateTime

java.lang.Object
java.time.ZonedDateTime
All Implemented Interfaces:
Comparable<ZonedDateTime>, TemporalAccessor

public final class ZonedDateTime extends java.lang.Object implements Comparable<ZonedDateTime>, TemporalAccessor
  • Method Details

    • now

      public static ZonedDateTime now()
    • now

      public static ZonedDateTime now(Clock clock)
    • of

      public static ZonedDateTime of(LocalDate date, LocalTime time, ZoneId zone)
    • of

      public static ZonedDateTime of(LocalDateTime dateTime, ZoneId zone)
    • ofInstant

      public static ZonedDateTime ofInstant(Instant instant, ZoneId zone)
    • parse

      public static ZonedDateTime parse(CharSequence text)
    • parse

      public static ZonedDateTime parse(CharSequence text, DateTimeFormatter formatter)
    • toLocalDateTime

      public LocalDateTime toLocalDateTime()
    • getZone

      public ZoneId getZone()
    • getOffset

      public ZoneOffset getOffset()
    • toInstant

      public Instant toInstant()
    • format

      public String format(DateTimeFormatter formatter)
    • compareTo

      public int compareTo(ZonedDateTime other)
      Description copied from interface: Comparable

      Compares this object to the specified object to determine their relative order.

      Parameters
      • another: the object to compare to this instance.
      Returns
      Specified by:
      compareTo in interface Comparable<ZonedDateTime>
      Returns:

      a negative integer if this instance is less than another; a positive integer if this instance is greater than another; 0 if this instance has the same order as another.

      Throws
      • ClassCastException: @throws ClassCastException if another cannot be converted into something comparable to this instance.
    • equals

      public boolean equals(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • toString

      public String toString()
      Overrides:
      toString in class java.lang.Object