DateTime#
A DateTime object is returned from e.g. System properties.
DateTime can only represent time points on or after 2000/01/01 00:00 UTC.
Methods#
DateTime.new(epoch) -> DateTime#
Create a new DateTime from the number of seconds since 1970/01/01 00:00 UTC, a.k.a epoch.
Returns nil if the epoch is invalid.
DateTime.new(year, month, monthDay) -> DateTime#
Create a new DateTime from a year (4 digits, i.e. 2000), month (1-12), monthDay (1-30).
Returns nil if the date is invalid. For example 2023/02/29 (2023 was NOT a leap year).
DateTime.new(year, month, monthDay, hour, minute, second) -> DateTime#
Create a new DateTime from a year (4 digits, i.e. 2000), month (1-12), monthDay (1-30), hour (0-23), minute (0-59), second [Optional] (0-59).
The time is expected to be in local time.
Returns nil if the time point is invalid. For example 2023/02/29 (2023 was NOT a leap year), or 12:60:00.
Properties#
Property |
Value Type |
Value Example |
|---|---|---|
|
integer |
|
|
integer |
|
|
integer |
|
|
string |
|
|
string |
|
|
integer (0 => Sunday) |
|
|
integer |
|
|
integer |
|
|
integer |
|
|
integer |
|