- java.lang.Object
-
- com.pervasive.datarush.tokens.scalar.CalendarDate
-
public final class CalendarDate extends Object
A specific date on the Gregorian calendar. ACalendarDate
contains only date information.A
CalendarDate
only partially specifies an instant in the time continuum; it must be combined with aTimeOfDay
andTimeZone
to produce a specific instant.- See Also:
Date
-
-
Constructor Summary
Constructors Constructor Description CalendarDate()
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.CalendarDate(Date date, TimeZone tz)
Constructs an instance representing the specified time in the given time zone.CalendarDate(TimeZone tz)
Constructs an instance representing the current day in the specified time zone.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
int
getDayOfMonth()
Get the day portion of the date.long
getDaysSinceEpoch()
Get the number of days elapsed since epoch.int
getMonthOfYear()
Get the month portion of the date.int
getYear()
Get the year portion of the date.int
hashCode()
static long
today()
Gets the current date in the default time zone as days since epoch.static long
today(TimeZone tz)
Gets the current date in the specified time zone as days since epoch.String
toString()
-
-
-
Constructor Detail
-
CalendarDate
public CalendarDate()
Constructs an instance representing the current day in the default time zone.
-
CalendarDate
public CalendarDate(TimeZone tz)
Constructs an instance representing the current day in the specified time zone.- Parameters:
tz
- the time zone 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
-
-
Method Detail
-
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
-
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(TimeZone tz)
Gets the current date in the specified time zone as days since epoch.- Parameters:
tz
- the time zone relative to which to interpret the current date- Returns:
- the number of days elapsed since January 1, 1970
-
-