Class CalendarDate

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

public final class CalendarDate extends Object
A specific date on the Gregorian calendar. A CalendarDate contains only date information.

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

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an instance representing the current day in the default time zone.
    CalendarDate(int year, int monthOfYear, int dayOfMonth)
    Constructs an instance representing the specified date.
    CalendarDate(long epochDays)
    Constructs an instance representing the date occurring the specified number of days after epoch.
    Constructs an instance representing the current day in the specified time zone.
    CalendarDate(Date date, ZoneId zoneId)
    Constructs an instance representing the specified time in the given time zone.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Get the day portion of the date.
    long
    Get the number of days elapsed since epoch.
    int
    Get the month portion of the date.
    int
    Get the year portion of the date.
    int
     
    static long
    Gets the current date in the default time zone as days since epoch.
    static long
    today(ZoneId zoneId)
    Gets the current date in the specified time zone as days since epoch.
     

    Methods inherited from class java.lang.Object

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

    • CalendarDate

      public CalendarDate()
      Constructs an instance representing the current day in the default time zone.
    • CalendarDate

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

      public CalendarDate(long epochDays)
      Constructs an instance representing the date occurring the specified number of days after epoch.
      Parameters:
      epochDays - the number of days elapsed since January 1, 1970
    • CalendarDate

      public CalendarDate(int year, int monthOfYear, int dayOfMonth)
      Constructs an instance representing the specified date. Month values are number as they are on a calendar, starting with 1 for January.
      Parameters:
      year - the year portion of the date
      monthOfYear - the month portion of the date. Months are counted as on a calendar, starting with 1 for January.
      dayOfMonth - the day portion of the date
    • CalendarDate

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

    • getDaysSinceEpoch

      public long getDaysSinceEpoch()
      Get the number of days elapsed since epoch.
      Returns:
      days elapsed since January 1, 1970
    • getYear

      public int getYear()
      Get the year portion of the date.
      Returns:
      the year
    • getMonthOfYear

      public int getMonthOfYear()
      Get the month portion of the date. Months are numbered as they would be on a calendar, starting with 1, representing January.
      Returns:
      the month of the year
    • getDayOfMonth

      public int getDayOfMonth()
      Get the day portion of the date.
      Returns:
      the day of the month
    • 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
    • today

      public static long today()
      Gets the current date in the default time zone as days since epoch.
      Returns:
      the number of days elapsed since January 1, 1970
    • today

      public static long today(ZoneId zoneId)
      Gets the current date in the specified time zone as days since epoch.
      Parameters:
      zoneId - the time zone Id relative to which to interpret the current date
      Returns:
      the number of days elapsed since January 1, 1970