bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: use of TZ by mktime()/strftime()


From: Andrew J. Schorr
Subject: Re: use of TZ by mktime()/strftime()
Date: Tue, 9 Aug 2022 13:52:38 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Aug 09, 2022 at 12:17:43PM -0500, Ed Morton wrote:
> Hmm, I just noticed that `date` behaves the same way gawk does when
> we set TZ in the environment rather than specify the timezone on the
> timestamp:
> 
>    $ TZ=EST date +'%s' -d '2022-01-01T12:00:00'
>    1641056400
> 
>    $ TZ=UTC date +'%s' -d '2022-01-01T12:00:00'
>    1641038400
> 
>    $ TZ=IST date +'%s' -d '2022-01-01T12:00:00'
>    1641038400
> 
>    $ date +'%s' -d '2022-01-01T12:00:00 IST'
>    1641018600
> 
> So in the above setting TZ to EST or UTC worked and specifying IST
> at the end of the timestamp worked, but setting TZ to IST failed
> just like it does in gawk. Clearly I'm missing something...

Oops, you beat me to it. Clearly "date -d" understands some time-zone
abbreviations that don't work when set in the TZ variable.
You'd need to dig into exactly how "date -d" works.

Regards,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]