# Date
Represents timestamps.
The Date API is still preliminary with only a subset of properties and methods implemented. Note that getting the current date, via Date.now, requires importing the Date object from the host (as Date).
WARNING
Date does not currently support timezones other than UTC. Therefore, methods such as toString and toTimeString can only be partially implemented.
# Constructor
- Constructs a new date object from an UTC timestamp in milliseconds.
new Date(value: i64)
# Static members
function now(): i64Returns the current UTC timestamp in milliseconds. To use this function you must import the
Dateobject from the host (asDate).function UTC( year: i32, month?: i32, day?: i32, hour?: i32, minute?: i32, second?: i32, millisecond?: i64 ): i64Returns the UTC timestamp in milliseconds of the specified date.
function parse(dateString: string): DateParses a Date object from a string (ISO 8601 format only).
function fromString(dateTimeString: string): DateCreates a Date object from an ISO 8601 formatted string.
# Instance members
function getTime(): i64Gets the UTC timestamp of this date in milliseconds.
function setTime(value: i64): i64Sets the UTC timestamp of this date in milliseconds and returns the timestamp.
function getUTCFullYear(): i32Gets the full year according to universal time.
function setUTCFullYear(value: i32): i32Sets the full year according to universal time.
function getUTCMonth(): i32Gets the (zero indexed) month according to universal time.
function setUTCMonth(value: i32): i32Sets the (zero indexed) month according to universal time.
function getUTCDate(): i32Gets the day of the month according to universal time.
function setUTCDate(value: i32): i32Sets the day of the month according to universal time.
function getUTCDay(): i32Gets the day of the week in the specified date according to universal time, where 0 represents Sunday.
function getUTCHours(): i32Gets the hour according to universal time.
function setUTCHours(value: i32): i32Sets the hour according to universal time.
function getUTCMinutes(): i32Gets the minute according to universal time.
function setUTCMinutes(value: i32): i32Sets the minute according to universal time.
function getUTCSeconds(): i32Gets the second according to universal time.
function setUTCSeconds(value: i32): i32Sets the second according to universal time.
function getUTCMilliseconds(): i32Gets the millisecond according to universal time.
function setUTCMilliseconds(value: i32): i32Sets the millisecond according to universal time.
function toISOString(): stringReturns the a string in simplified extended ISO 8601 format.
function toUTCString(): stringReturns the a string in RFC-1123 format and the UTC time zone.
function toDateString(): stringReturns the a date string in human readable form in English WWW MMM DD YYYY format.
function toTimeString(): stringReturns the a time string in HH:MM:SS format.
WARNING
At the moment toTimeString doesn't output time zone and doesn't use local time zone offset!
- Returns the a time string in human readable form in English WWW MMM DD YYYY HH:MM:SS format.
function toString(): string
WARNING
At the moment toString doesn't output time zone and doesn't use local time zone offset!