java.lang.Object
com.pervasive.datarush.tokens.scalar.CalendarDate
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
ConstructorsConstructorDescriptionConstructs 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.CalendarDate(ZoneId zoneId) 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 TypeMethodDescriptionbooleanintGet the day portion of the date.longGet the number of days elapsed since epoch.intGet the month portion of the date.intgetYear()Get the year portion of the date.inthashCode()static longtoday()Gets the current date in the default time zone as days since epoch.static longGets the current date in the specified time zone as days since epoch.toString()
-
Constructor Details
-
CalendarDate
public CalendarDate()Constructs an instance representing the current day in the default time zone. -
CalendarDate
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 datemonthOfYear- 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
Constructs an instance representing the specified time in the given time zone.- Parameters:
date- the instant in time from which to extract date informationzoneId- 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
-
hashCode
public int hashCode() -
toString
-
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
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
-