[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About mktime(, 1)
From: |
Neil R. Ormos |
Subject: |
Re: About mktime(, 1) |
Date: |
Mon, 8 Nov 2021 22:43:30 -0600 (CST) |
Peng Yu wrote:
> I got 4 as the result of the following command. Shouldn't Eastern time
> be 5 hours different from UTC? Or, did I misunderstand something?
>
> $ TZ=US/Eastern awk -e 'BEGIN { print (mktime("2021 07 18 00 00 00") -
> mktime("2021 07 18 00 00 00", 1))/3600 }'
> 4
DST is observed during July [*], so the offset between EDT and UTC is 4 hours.
$ TZ=US/Eastern date -d '2021-07-18 00:00:00' +"%c %Z %z"
Sun Jul 18 00:00:00 2021 EDT -0400
~$ TZ=US/Eastern date -d '2021-11-18 00:00:00' +"%c %Z %z"
Thu Nov 18 00:00:00 2021 EST -0500
[*] In most of the US/Eastern time zone.