timezone
Constants that give the IANA name of common time zones, for TIMEZONE IS lines and the datetime constructors. Import it with IMPORT timezone.
Example:
-- Timezone Example: IANA timezone constants
IMPORT timezone
-- Set document timezone using a constant
TIMEZONE IS EST
-- Verify the resolved IANA name
DECIDE `document timezone` IS TIMEZONE
#EVAL `document timezone` -- "America/New_York"
-- Timezone constants resolve to IANA strings
#EVAL EST -- "America/New_York"
#EVAL PST -- "America/Los_Angeles"
#EVAL SGT -- "Asia/Singapore"
#EVAL UTC -- "Etc/UTC"
-- EST and EDT map to the same zone (DST handled automatically)
#ASSERT EST EQUALS EDT
Setting the document time zone
IMPORT timezone
TIMEZONE IS SGT
sets the document's time zone to "Asia/Singapore". Without the library, write the IANA name itself:
TIMEZONE IS "Asia/Singapore"
Constants
Each constant is a STRING.
| Constant | IANA name |
|---|---|
| EST, EDT | America/New_York |
| CST, CDT | America/Chicago |
| MST, MDT | America/Denver |
| PST, PDT | America/Los_Angeles |
| GMT, BST | Europe/London |
| CET, CEST | Europe/Berlin |
| EET, EEST | Europe/Helsinki |
| IST | Asia/Kolkata |
| SGT | Asia/Singapore |
| HKT | Asia/Hong_Kong |
| JST | Asia/Tokyo |
| KST | Asia/Seoul |
| AEST, AEDT | Australia/Sydney |
| NZST, NZDT | Pacific/Auckland |
| UTC | Etc/UTC |
Daylight saving time
The standard and the daylight-saving abbreviation of a zone give the same IANA name, so EST and EDT are both "America/New_York". Whether daylight saving applies is worked out from the date, not from the abbreviation you chose.
IMPORT timezone
#ASSERT EST EQUALS EDT