help-gawk
[Top][All Lists]
Advanced

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

Re: time zone for strftime


From: Andrew J. Schorr
Subject: Re: time zone for strftime
Date: Wed, 21 Jul 2021 21:55:53 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Jul 21, 2021 at 09:51:20PM -0400, Andrew J. Schorr wrote:
> On Wed, Jul 21, 2021 at 08:30:45PM -0500, Peng Yu wrote:
> > https://www.gnu.org/software/gawk/manual/html_node/Time-Functions.html
> > 
> > I don't see a way to specify a time zone for strftime when converting
> > an epoch time to the time zone time. Is there a way to do it? Thanks.
> 
> bash-4.2$ gawk 'BEGIN {t = systime(); ENVIRON["TZ"] = "US/Central"; print 
> strftime("%c", t); ENVIRON["TZ"] = "US/Eastern"; print strftime("%c", t)}'
> Wed 21 Jul 2021 08:50:54 PM CDT
> Wed 21 Jul 2021 09:50:54 PM EDT

Although I'm not certain whether that works on non-Unix platforms...

Regards,
Andy



reply via email to

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