Date
The Date module allows for easy description of time. It is modeled after the JavaScript Date object.
Constructors¶
Date.new([Number seconds [, Boolean useUTC]])¶
Date.fromJSON(String jsonString)¶
1 2 | |
Methods¶
ToJSON()¶
Converts the Date object to a JSON string.
1 | |
ToSeconds()¶
Returns the number of seconds representing the object. This is the most practical method to use for saving/serializing the date, since it has the smallest footprint.
1 | |
GetTimezoneHourOffset()¶
Get the timezone offset in hours.
1 2 | |
Format(String format)¶
Format the date string. See the GNU Date Commands for relevant formats.
1 2 3 | |
ToUTC()¶
Constructs and returns a new Date object with the time converted to UTC.
1 2 | |
ToLocal()¶
Constructs and returns a new Date object with the time converted from UTC time into local time.
1 2 | |
ToISOString()¶
Returns the ISO string representation of the date.
1 | |
ToDateString()¶
Returns a string representing the shorthand date.
1 | |
ToTimeString()¶
Returns a string representing the time.
1 | |
ToString()¶
Returns a string representing the time and date combined.
1 2 3 4 | |
Properties¶
Hour¶
The hour of the day.
Minute¶
The minute of the day.
Weekday¶
The numeric weekday.
Day¶
The day of the month.
Month¶
The numeric month.
Year¶
The year.
Second¶
The seconds since January 1, 1970.
Millisecond¶
The milliseconds since January 1, 1970.
Yearday¶
The day of the year.
IsDST¶
Whether or not the date represents daylight saving time.
Operators¶
Simple comparison operators can be used on dates.
1 2 3 4 5 6 | |