Calendar¶
-
Calendar inherits ObjectConstruction:
Calendar newObj = Calendar();
Clone:Calendar newObj = Calendar(other);
Calendar is a utility to represent absolute date and time. It supports representation of time in the standard format of year, month, day, hour, minute, and second. It also supports epoch, J2000, and Julian date representations. All methods except Calendar.ToStringLocalDate and Calendar.ToStringLocalTime reference Universal Time.
Static Methods¶
- static Calendar Construct()¶
Return a new Calendar object initialized to the current system time.
For example:
Calendar c = Calendar.Construct(); writeln(c.Month(), " ", c.Day(), " ", c.Year());
- static Calendar Construct(double aEpoch)¶
Return a new Calendar object initialized to the given epoch-value.
- static Calendar Construct(string aIso8601Value)¶
Return a new Calendar object initialized to the given ISO 8601 time point. If the provided ISO 8601 value is not valid, a script error is generated. The provided ISO 8601 time point must be Zulu (Z) time; no time offsets are supported.
For example:
Calendar c1 = Calendar.Construct("2019-01-01T00:00:00.000Z"); Calendar c2 = Calendar.Construct("2019-02-01T14:30Z"); Calendar c3 = Calendar.Construct("2019-02-28");
Methods¶
- void AdvanceTime(double aSeconds)¶
Advance the time to “aSeconds” in the future.
- int Hour()¶
Return the integer hour (0-23).
- int Minute()¶
Return the number of minutes past the hour (0-59).
- double Second()¶
Return the number of seconds past the current minute.
- double Epoch()¶
Return the epoch-value associated with the current time of the calendar.
- void SetEpoch(double aEpoch)¶
Set the current epoch-value using the four-digit epoch format(“yyyyddd.ssssss”).
- int Year()¶
Return the current year.
- int Month()¶
Return the current month (1-12).
- int Day()¶
Return the current day of the month (1-31).
- double SecondsPastMidnight()¶
Return the number of seconds elapsed since the start of the current day (0-86399).
- double J2000_Date()¶
Return J2000 date (number of days since 12:00:00 UT1 on 1 January 2000 AD).
- double JulianDate()¶
Return the full Julian date (number of days since 12:00:00 UTC on 1 January 4713 BC
For example:
- 12:00:00 UTC on 1 January 2000 is 2451545.0 - 00:00:00 UTC on 1 January 2000 is 2451544.5
- int JulianDay()¶
Return the integer Julian day (see Calendar.JulianDate, above).
- bool SetDate(int aYear, int aMonth, int aDay)¶
Set the current date in year (including century), month( 1-12) and day of month( 1-31) format. Returns whether the set was successful (it will only fail if the inputs are out of range).
- bool SetTime(int aHour, int aMinute, double aSecond)¶
Set the current time in hour (0-23), minute (0-59), second (0-59.f) format. Returns whether the set was successful (it will only fail if the inputs are out of range).
- void SetJ2000_Date(double aJ2000_Date)¶
Set the J2000 date (number of days since 12:00:00 UTC on 1 January 2000 AD).
- void SetJulianDate(double aJulianDate)¶
Set the Julian date (number of days since 12:00:00 UTC on 1 January 4713 BC; see examples above).
- void SetToSystemTime()¶
Set the object’s time to the current system time.
- double TimeSince(Calendar aReferenceTime)¶
Return the relative time in seconds since aReferenceTime.
- string ToStringTime()¶
Return the time in (HH:MM:SS) format (seconds value truncated to an integer).