Archmage.DateTime
A point in time with the UTC offset it was written with, the type of a datetime field.
Inherits: RefCounted
In the config files, a datetime is an RFC 3339 string, such as 2025-01-01T08:30:00+08:00, or null when it is zero. The zero value is the instant 0001-01-01T00:00:00Z, as in Go.
Constants
Section titled “Constants”ZERO_UNIX_TIME
Section titled “ZERO_UNIX_TIME”const ZERO_UNIX_TIME = -62135596800The Unix time of the instant at 0001-01-01T00:00:00Z.
Properties
Section titled “Properties”unix_time
Section titled “unix_time”var unix_time: int = -62135596800The seconds since 1970-01-01T00:00:00Z, the value that Time.get_unix_time_from_system() returns.
nanosecond
Section titled “nanosecond”var nanosecond: intThe nanoseconds within the second, from 0 to 999999999.
offset
Section titled “offset”var offset: intThe UTC offset in seconds, such as 28800 for +08:00. to_json() writes the time with this offset.
Methods
Section titled “Methods”is_zero()
Section titled “is_zero()”func is_zero() -> boolReturns whether this is the zero value. An instant is zero regardless of its offset.
from_json()
Section titled “from_json()”static func from_json(v: Variant, e: Archmage.ParseError = null) -> Archmage.DateTimeReturns the datetime in v, a parsed JSON value. For null, returns the zero value. For any other value that is not an RFC 3339 string, records the error in e (see Archmage.ParseError.report()) and returns the zero value.
to_json()
Section titled “to_json()”func to_json() -> VariantReturns the datetime as an RFC 3339 string with offset, or null for the zero value. The fraction of a second is written only when it is not zero, and the offset 0 is written as Z.