[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Idea for handling timezones
From: |
Shironeko |
Subject: |
Re: Idea for handling timezones |
Date: |
Sat, 03 Apr 2021 17:26:43 +0800 |
User-agent: |
Evolution 3.38.4 |
tz database and tools using it like the date(1) command can convert between
local times taking into account all the difference like daylight savings time.
An example below, Toronto observes daylight savings whereas Shanghai does not:
$ TZ=Asia/Shanghai date --date='TZ="America/Toronto" 2021-11-07 Sun 00:30'
Sun 7 Nov 12:30:00 CST 2021
$ TZ=Asia/Shanghai date --date='TZ="America/Toronto" 2021-11-07 Sun 01:30'
Sun 7 Nov 13:30:00 CST 2021
$ TZ=Asia/Shanghai date --date='TZ="America/Toronto" 2021-11-07 Sun 02:30'
Sun 7 Nov 15:30:00 CST 2021
$ TZ=America/Toronto date --date='TZ="Asia/Shanghai" 2021-11-07 Sun 12:30'
Sun 7 Nov 00:30:00 EDT 2021
$ TZ=America/Toronto date --date='TZ="Asia/Shanghai" 2021-11-07 Sun 13:30'
Sun 7 Nov 01:30:00 EDT 2021
$ TZ=America/Toronto date --date='TZ="Asia/Shanghai" 2021-11-07 Sun 14:30'
Sun 7 Nov 01:30:00 EST 2021
$ TZ=America/Toronto date --date='TZ="Asia/Shanghai" 2021-11-07 Sun 15:30'
Sun 7 Nov 02:30:00 EST 2021
The ambiguity caused by dialing back is resolved with
$ TZ=Asia/Shanghai date --date='TZ="America/Toronto" 2021-11-07 Sun 01:30 EDT'
Sun 7 Nov 13:30:00 CST 2021
$ TZ=Asia/Shanghai date --date='TZ="America/Toronto" 2021-11-07 Sun 01:30 EST'
Sun 7 Nov 14:30:00 CST 2021
With this, say the user have
#+TIMEZONE: America/Toronto
at the start of their org file, and they moved to Shanghai, all the timestamp in
the org file is converted using something equivalent to
$ TZ=Asia/Shanghai date --date='TZ="America/Toronto" '"$TIMESTAMP"
and the file header changed to
#+TIMEZONE: Asia/Shanghai
when they get back the timestamp is returned with
$ TZ=America/Toronto date --date='TZ="Asia/Shanghai" '"$TIMESTAMP"
shiro
signature.asc
Description: This is a digitally signed message part
- Idea for handling timezones, shironeko, 2021/04/02
- Re: Idea for handling timezones, tomas, 2021/04/02
- Re: Idea for handling timezones, Shironeko, 2021/04/02
- Re: Idea for handling timezones, tomas, 2021/04/03
- Re: Idea for handling timezones, shironeko, 2021/04/03
- Re: Idea for handling timezones, tomas, 2021/04/03
- Re: Idea for handling timezones,
Shironeko <=
- Re: Idea for handling timezones, Greg Minshall, 2021/04/03
- Re: Idea for handling timezones, Russell Adams, 2021/04/03
- Re: Idea for handling timezones, Greg Minshall, 2021/04/03
- Re: Idea for handling timezones, Samuel Wales, 2021/04/03
- Re: Idea for handling timezones, Tim Cross, 2021/04/03
- Re: Idea for handling timezones, Tom Gillespie, 2021/04/03
- Re: Idea for handling timezones, Maxim Nikulin, 2021/04/04
- Re: Idea for handling timezones, Shironeko, 2021/04/22
- Re: Idea for handling timezones, tomas, 2021/04/23
- Re: Idea for handling timezones, tomas, 2021/04/03