Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Use the zdump Command to Check Daylight Savings Time Settings

August 24, 2023 — Gregg Szumowski

If you are one of us lucky folks who live in timezones that observe Daylight Savings Time, you can use the zdump timezone dumper command to view your server’s settings for same. This command prints the current time in each timezone provided on the command line.

You can use grep to reduce the output to just the lines that reference the current year:

$ zdump -v EST5EDT |grep '2023'
EST5EDT Sun Mar 12 06:59:59 2023 UT = Sun Mar 12 01:59:59 2023 EST isdst=0 gmtoff=-18000
EST5EDT Sun Mar 12 07:00:00 2023 UT = Sun Mar 12 03:00:00 2023 EDT isdst=1 gmtoff=-14400
EST5EDT Sun Nov 5 05:59:59 2023 UT = Sun Nov 5 01:59:59 2023 EDT isdst=1 gmtoff=-14400
EST5EDT Sun Nov 5 06:00:00 2023 UT = Sun Nov 5 01:00:00 2023 EST isdst=0 gmtoff=-18000

You can also run the same command by location:

$ zdump -v /usr/share/zoneinfo/America/New_York|grep '2023'
/usr/share/zoneinfo/America/New_York Sun Mar 12 06:59:59 2023 UT = Sun Mar 12 01:59:59 2023 EST isdst=0 gmtoff=-18000
/usr/share/zoneinfo/America/New_York Sun Mar 12 07:00:00 2023 UT = Sun Mar 12 03:00:00 2023 EDT isdst=1 gmtoff=-14400
/usr/share/zoneinfo/America/New_York Sun Nov 5 05:59:59 2023 UT = Sun Nov 5 01:59:59 2023 EDT isdst=1 gmtoff=-14400
/usr/share/zoneinfo/America/New_York Sun Nov 5 06:00:00 2023 UT = Sun Nov 5 01:00:00 2023 EST isdst=0 gmtoff=-18000

Tags: cli, zdump, timezones, motd