Skip to content

Display time in a different timezone? #1095

Answered by kar1
dotpot asked this question in Q&A
Discussion options

You must be logged in to vote

Lua only reports the time of the operating system. The time docs are here: http://www.lua.org/manual/5.2/manual.html#pdf-os.date

You could take that time as UTC and add the offset for US/Pacific -7:

os.date("!%a %b %d %H:%M:%S %Y ", os.time() - 7 * 60 * 60)

But that doesn't adjust for different summer time offsets if any. For a more complete Lua solution you could install a Lua module like: https://github.com/daurnimator/luatz

For the date command you could try this:

wezterm.run_child_process({"/bin/sh", "-c", "TZ=US/Pacific date"});

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@wez
Comment options

Answer selected by dotpot
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants