I recently discovered that the Unix date
command (at least the GNU Core Utilities version I have on Ubuntu) is amazing at converting time zones. On its own it gives the exact time now (by default date
gives a full timestamp), but say “CET now” to get the time here when it’s this time in Central European Time, if you see what I mean.
$ date
Wed 12 Jan 2022 12:19:16 AM EST
$ date --date="CET now"
Tue 11 Jan 2022 06:19:17 PM EST
That’s confusing, I admit. But if there’s an online session you want to catch but it’s in Sydney, Australia on Friday 14 January 2022 at 2 pm, then if you check that Australian Eastern Standard Time (AEST) is UTC+10 you can convert.
$ date --date="2022-01-14 14:00 UTC+10"
Thu 13 Jan 2022 11:00:00 PM EST
However, it’s not actually UTC+10 right now, because they’re on summer time, so it’s Australian Eastern Daylight Saving Time (AEDT), which is UTC+11. Or tzselect
helps determine the time zone is “Australia/Sydney,” which can be used thus:
$ date --date='TZ="Australia/Sydney" 2022-01-14 14:00'
Thu 13 Jan 2022 10:00:00 PM EST
(All international times should include a UTC offset so this is easier to handle.)
There are lots of web sites that do these conversions, but this is local, private, secure and ad-free.
My two favourite date formats, the first for humans, the second for machines:
$ date +"%d %B %Y"
12 January 2022
$ date +"%Y-%m-%d"
2022-01-12