ZonedDateTime¶
A UTC moment plus zone context (an IANA zone OR a fixed offset).
Storage: POSIX (sec, nsec) UTC + zone name (or "" for Offset mode) + resolved Observation (local fields, offset, abbrev, isdst).
REF capability. Allocate once and reuse via reset_to,
to_timezone_in_place, etc. For cross-actor sharing, convert via
to_posix() + zone_name() (or offset_sec() when in Offset mode)
and reconstruct in the receiver actor.
Construction patterns¶
ZonedDateTime.now() // UTC
ZonedDateTime.now_in_zone("America/Los_Angeles")? // IANA
ZonedDateTime.now_at_offset(-7 * 3600) // fixed offset
ZonedDateTime.from_posix((sec, nsec)) // reconstruct UTC
ZonedDateTime.from_posix_in_zone((sec, nsec), name)?
ZonedDateTime.from_posix_at_offset((sec, nsec), offset_sec)
Constructors¶
now¶
Wall-clock now, in UTC.
Returns¶
- ZonedDateTime ref^
now_in_zone¶
Wall-clock now, in the specified IANA zone. Errors if the zone
isn't in the bundled tzdata (use try_zone(name) on an existing
ZDT for richer error info).
Parameters¶
- name: String val
Returns¶
- ZonedDateTime ref^ ?
now_at_offset¶
Wall-clock now, at a fixed numeric offset (not an IANA zone).
Parameters¶
- offset_sec': I32 val
Returns¶
- ZonedDateTime ref^
from_posix¶
Reconstruct a UTC ZonedDateTime from a POSIX tuple.
Parameters¶
Returns¶
- ZonedDateTime ref^
from_posix_in_zone¶
Construct a ZonedDateTime in an IANA zone from a POSIX tuple.
Parameters¶
Returns¶
- ZonedDateTime ref^ ?
from_posix_at_offset¶
Construct a ZonedDateTime at a fixed offset from a POSIX tuple.
Parameters¶
Returns¶
- ZonedDateTime ref^
Public Functions¶
reset_to¶
Mutate to represent a different UTC instant in the same zone (or offset). For Zone mode, re-resolves against the bundled tzdata — may fail if the new instant falls outside coverage, in which case self is left unchanged.
Parameters¶
Returns¶
- (None val | TzLookupError)
to_timezone_in_place¶
Mutate to represent the same UTC instant in a different IANA zone. Returns ZoneNotFound or OutOfCoverage on failure; self is left unchanged on error.
Parameters¶
- name: String val
Returns¶
- (None val | TzLookupError)
reset_at_offset¶
Mutate to a UTC instant at a fixed offset, switching this ZDT to
Offset mode. Symmetric with from_posix_at_offset but reuses
self — no allocation.
Parameters¶
Returns¶
- None val
reset_in_zone¶
Mutate to a UTC instant in an IANA zone, switching this ZDT to
Zone mode. Symmetric with from_posix_in_zone; self is left
unchanged on error.
Parameters¶
Returns¶
- (None val | TzLookupError)
to_timezone¶
Return a NEW ZonedDateTime representing the same UTC instant in a different IANA zone. Allocates one heap object on success.
Parameters¶
- name: String val
Returns¶
- (ZonedDateTime iso^ | TzLookupError)
to_posix¶
Returns¶
kind¶
Returns¶
zone_name¶
Returns¶
- String val
local_date¶
Returns¶
- Date val
local_tod¶
Returns¶
- TimeOfDay val
offset_sec¶
Returns¶
- I32 val
abbreviation¶
Returns¶
- String val
is_dst¶
Returns¶
- Bool val
string¶
RFC 3339 / ISO 8601 representation of this ZonedDateTime.
Format: YYYY-MM-DDTHH:MM:SS[.nnnnnnnnn][Z|±HH:MM]
- Date part comes from
local_date().string()(YYYY-MM-DD, negative years prefixed with '-'). - Time part comes from
local_tod().string()(HH:MM:SS, or HH:MM:SS.nnnnnnnnn when sub-second precision is non-zero). - Offset is
Zfor zero offset, or±HH:MMotherwise (sub-minute offsets — LMT-era — are rounded for the suffix; precise value remains available viaoffset_sec()).
The IANA zone name is NOT in the output — RFC 3339 carries an
offset, not a zone. Use zone_name() separately if you need it.
Returns¶
- String iso^