///|
test {
// creates a UTC+8 fixed time zone.
let zone = @time.fixed_zone("Asia/Shanghai", 8 * 60 * 60)
// creates a ZonedDateTime from unix second and time zone.
let date_time = try? @time.unix(1714227729L, nanosecond=1000, zone~)
inspect(
date_time,
content="Ok(2024-04-27T22:22:09.000001+08:00[Asia/Shanghai])",
)
}type Durationtype Periodtype PlainDatetype PlainDateTimeimpl Compare for PlainDateTimeimpl Eq for PlainDateTimeimpl Show for PlainDateTimeimpl ToJson for PlainDateTimeimpl FromJson for PlainDateTimefn PlainDateTime::from_unix_second(second : Int64, nanosecond : Int, offset : ZoneOffset) -> PlainDateTime raisefn PlainDateTime::of(year : Int, month : Int, day : Int, hour? : Int, minute? : Int, second? : Int, nanosecond? : Int) -> PlainDateTime raisetype PlainTimepub(all) enum Weekday {
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
}type Zonetype ZoneOffsetimpl Compare for ZoneOffsetimpl Eq for ZoneOffsetimpl Show for ZoneOffsetfn ZoneOffset::of(hours? : Int, minutes? : Int, seconds? : Int, abbrev? : String, dst? : Bool) -> ZoneOffset raisetype ZonedDateTimeimpl Eq for ZonedDateTimeimpl Show for ZonedDateTimeimpl ToJson for ZonedDateTimeimpl FromJson for ZonedDateTimefn ZonedDateTime::from_unix_second(second : Int64, nanosecond? : Int, zone? : Zone) -> ZonedDateTime raisefn ZonedDateTime::of(year : Int, month : Int, day : Int, hour? : Int, minute? : Int, second? : Int, nanosecond? : Int, zone? : Zone) -> ZonedDateTime raisefn date_time(year : Int, month : Int, day : Int, hour? : Int, minute? : Int, second? : Int, nanosecond? : Int, zone? : Zone) -> ZonedDateTime raise