Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

time.zones

the same moment in UTC, local time, any IANA zone or a city; world clocks

Example results generated on 2026-10-08. Ones using now, today or randomness will differ when you run them: press Run on any example to run it in your browser, after editing it if you like.

conversions

# to UTC, to local
date("2026-12-25 18:30") to UTC
# → 2026-12-26 00:30:00 +00:00
# to "Zone/Name"
date("2026-12-25 18:30") to "Asia/Tokyo"
# → 2026-12-26 09:30:00 +09:00
# to "City" or "Country"
date("2026-12-25 18:30") to "Sao Paulo"
# → 2026-12-25 21:30:00 -03:00
# a zone in a variable
z = "Asia/Tokyo"; date("2026-12-25 18:30") to (z)
# → 2026-12-26 09:30:00 +09:00

Functions

functiondescription
utc(d: date)the same moment in UTC; same as d to UTC (d to "Asia/Tokyo" for any zone)
local(d: date)the same moment in the system time zone; same as d to local
clock(places: list) / clock(place: str)the time now in each zone or city

utc

utc(d: date): the same moment in UTC; same as d to UTC (d to "Asia/Tokyo" for any zone)

date(0) to UTC
# → 1970-01-01 00:00:00 +00:00
date(0).utc.year
# → 1970

See also: local, date

local

local(d: date): the same moment in the system time zone; same as d to local

(date(0) to UTC).local.year
# → 1969

See also: utc

clock

clock(places: list) / clock(place: str): the time now in each zone or city

clock(["Tokyo", "London"])
# → {Tokyo: 2026-10-08 21:58:47 +09:00, London: 2026-10-08 13:58:47 +01:00}
clock("Asia/Kolkata").hour >= 0
# → true

See also: utc, local

More examples

zones

# time zones
date("2026-12-25 18:30") to "Asia/Tokyo"
# → 2026-12-26 09:30:00 +09:00
# meeting time abroad
5pm to "London"
# → 2026-10-08 23:00:00 +01:00
# world clock
clock(["Tokyo", "London", "New York"])
# → {Tokyo: 2026-10-08 21:58:47 +09:00, London: 2026-10-08 13:58:47 +01:00, New York: 2026-10-08 08:58:47 -04:00}