Class TimeOfDay

java.lang.Object
com.pervasive.datarush.tokens.scalar.TimeOfDay

public final class TimeOfDay extends Object
A specific moment of time on a 24-hour clock. A TimeOfDay contains only time information, up to millisecond precision.

A TimeOfDay only partially specifies an instant in the time continuum; it must be combined with a CalendarDate and ZoneId to produce a specific instant.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an instance representing the current time in the default timezone.
    TimeOfDay(int dayMillis)
    Constructs an instance representing the time occurring the specified number of milliseconds after midnight.
    TimeOfDay(int hourOfDay, int minuteOfHour)
    Constructs an instance representing the specified time, expressed in 24-hour format.
    TimeOfDay(int hourOfDay, int minuteOfHour, int secondOfMinute)
    Constructs an instance representing the specified time, expressed using 24-hour format.
    TimeOfDay(ZoneId zoneId)
    Constructs an instance representing the current time in the specified timezone.
    TimeOfDay(Date time, ZoneId zoneId)
    Constructs an instance representing the specified time in the given timezone.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Get the hour portion, in 24-hour format, of the time of day.
    int
    Get the number of milliseconds elapsed since midnight
    int
    Get the minutes portion of the time of day.
    int
    Get the seconds portion of the time of day.
    int
    Get the millisecond portion of the time of day.
    int
     
    static int
    now()
    Gets the current time of day in the default time zone as milliseconds since midnight.
    static int
    now(ZoneId zoneId)
    Gets the current time of day in the specified time zone as milliseconds since midnight.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TimeOfDay

      public TimeOfDay()
      Constructs an instance representing the current time in the default timezone.
    • TimeOfDay

      public TimeOfDay(ZoneId zoneId)
      Constructs an instance representing the current time in the specified timezone.
      Parameters:
      zoneId - the zone id to which the current time is relative
    • TimeOfDay

      public TimeOfDay(int dayMillis)
      Constructs an instance representing the time occurring the specified number of milliseconds after midnight.
      Parameters:
      dayMillis - the number of milliseconds elapsed since midnight
    • TimeOfDay

      public TimeOfDay(int hourOfDay, int minuteOfHour)
      Constructs an instance representing the specified time, expressed in 24-hour format.
      Parameters:
      hourOfDay - the hour portion of the time
      minuteOfHour - the minute portion of the time
    • TimeOfDay

      public TimeOfDay(int hourOfDay, int minuteOfHour, int secondOfMinute)
      Constructs an instance representing the specified time, expressed using 24-hour format.
      Parameters:
      hourOfDay - the hour portion of the time
      minuteOfHour - the minutes portion of the time
      secondOfMinute - the seconds portion of the time
    • TimeOfDay

      public TimeOfDay(Date time, ZoneId zoneId)
      Constructs an instance representing the specified time in the given timezone.
      Parameters:
      time - the instant in time from which to extract time information
      zoneId - the zone id in which to interpret the specified instant
  • Method Details

    • getMillisSinceMidnight

      public int getMillisSinceMidnight()
      Get the number of milliseconds elapsed since midnight
      Returns:
      milliseconds elapsed since midnight
    • getHourOfDay

      public int getHourOfDay()
      Get the hour portion, in 24-hour format, of the time of day.
      Returns:
      the hour of the day
    • getMinuteOfHour

      public int getMinuteOfHour()
      Get the minutes portion of the time of day.
      Returns:
      the minute within the hour
    • getSecondOfMinute

      public int getSecondOfMinute()
      Get the seconds portion of the time of day.
      Returns:
      the second within the minute
    • getSubsecondMillis

      public int getSubsecondMillis()
      Get the millisecond portion of the time of day.
      Returns:
      the milliseconds within the second
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object
    • now

      public static int now()
      Gets the current time of day in the default time zone as milliseconds since midnight.
      Returns:
      the number of milliseconds elapsed since midnight
    • now

      public static int now(ZoneId zoneId)
      Gets the current time of day in the specified time zone as milliseconds since midnight.
      Parameters:
      zoneId - the zone id relative to which to interpret the current time
      Returns:
      the number of milliseconds elapsed since midnight