Class PGTime

java.lang.Object
java.util.Date
java.sql.Time
org.postgresql.util.PGTime
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Date>

public class PGTime extends Time
This class augments the Java built-in Time to allow for explicit setting of the time zone.
See Also:
  • Constructor Details

    • PGTime

      public PGTime(long time)
      Constructs a PGTime without a time zone.
      Parameters:
      time - milliseconds since January 1, 1970, 00:00:00 GMT; a negative number is milliseconds before January 1, 1970, 00:00:00 GMT.
      See Also:
    • PGTime

      public PGTime(long time, @Nullable Calendar calendar)
      Constructs a PGTime with the given calendar object. The calendar object is optional. If absent, the driver will treat the time as time without time zone. When present, the driver will treat the time as a time with time zone using the TimeZone in the calendar object. Furthermore, this calendar will be used instead of the calendar object passed to PreparedStatement.setTime(int, Time, Calendar).
      Parameters:
      time - milliseconds since January 1, 1970, 00:00:00 GMT; a negative number is milliseconds before January 1, 1970, 00:00:00 GMT.
      calendar - the calendar object containing the time zone or null.
      See Also:
  • Method Details

    • setCalendar

      public void setCalendar(@Nullable Calendar calendar)
      Sets the calendar object for this time.
      Parameters:
      calendar - the calendar object or null.
    • getCalendar

      public @Nullable Calendar getCalendar()
      Returns the calendar object for this time.
      Returns:
      the calendar or null.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Date
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Date
    • clone

      public Object clone()
      Overrides:
      clone in class Date