Convert Date and Time to New Timezone¶
A simple command-line utility for converting a date and time to a new timezone.
> totz tomorrow 1pm MST given : Saturday 10 December 2016, 1:00pm -07:00 (MST). desired: Saturday 10 December 2016, 12:00pm -08:00 (US/Pacific), in a day. > totz 1969 July 20 13:32:00 UTC given : Sunday 20 July 1969, 1:32pm +00:00 (UTC). desired: Sunday 20 July 1969, 6:32am -07:00 (US/Pacific), 47 years ago. > totz --to est today 4pm local given : Friday 9 December 2016, 4:00pm -08:00 (US/Pacific). desired: Friday 9 December 2016, 7:00pm -05:00 (EST), in 3 hours. > totz -t America/Chicago mon 9am local given : Monday 12 December 2016, 9:00am -08:00 (US/Pacific). desired: Monday 12 December 2016, 11:00am -06:00 (America/Chicago), in 2 days.
Use ‘tzselect’ (a shell command) for help with finding the names of timezones.
mytz [options] [--] <specification>...
-t TZ, --to TZ Convert to specified timezone.
The specification must include a date, a time, and a timezone.
You can specify the date with the following formats:
You can specify the time with the following formats:
You can specify the timezone with the following formats:
You can specify the timezone as a negative offset in two ways. One way is to place the sign after the offset to avoid the offset from being confused as an option. The other way is to terminate the option processing by placing ‘–’ before the specification.
Clone from GitHub with:
git clone https://github.com/KenKundert/totz.git
Then install with:
cd totz pip install . --user
Requires Python3.4 or later.