Skip to content

Instantly share code, notes, and snippets.

@greymd greymd/ddst.md
Last active Mar 31, 2018

Embed
What would you like to do?
Detect daylight saving time with date
$ echo 20180311" "{01..23}":00:00 JST" | xargs -n3 | TZ=America/New_York gdate -f-
Sat Mar 10 11:00:00 EST 2018
Sat Mar 10 12:00:00 EST 2018
Sat Mar 10 13:00:00 EST 2018
Sat Mar 10 14:00:00 EST 2018
Sat Mar 10 15:00:00 EST 2018
Sat Mar 10 16:00:00 EST 2018
Sat Mar 10 17:00:00 EST 2018
Sat Mar 10 18:00:00 EST 2018
Sat Mar 10 19:00:00 EST 2018
Sat Mar 10 20:00:00 EST 2018
Sat Mar 10 21:00:00 EST 2018
Sat Mar 10 22:00:00 EST 2018
Sat Mar 10 23:00:00 EST 2018
Sun Mar 11 00:00:00 EST 2018
Sun Mar 11 01:00:00 EST 2018
Sun Mar 11 03:00:00 EDT 2018 ### Daylight Saving Time start!!
Sun Mar 11 04:00:00 EDT 2018
Sun Mar 11 05:00:00 EDT 2018
Sun Mar 11 06:00:00 EDT 2018
Sun Mar 11 07:00:00 EDT 2018
Sun Mar 11 08:00:00 EDT 2018
Sun Mar 11 09:00:00 EDT 2018
Sun Mar 11 10:00:00 EDT 2018
$ gdate -d'Sun Mar 11 03:00:00 EDT 2018' +%s
1520751600

$ gdate -d'Sun Mar 11 02:00:00 EST 2018' +%s
1520751600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.