[CentOS] Date question

Wed Feb 17 19:37:54 UTC 2021
Chris Schanzle <chris.schanzle at nist.gov>

On 2/17/21 1:57 PM, Jerry Geis wrote:
> SO from the man page on date I can do
>
> current=`TZ=":America/Indianapolis" date`
> echo $current
> current=`TZ=":America/Los_Angeles" date `
> echo $current
>
> And I get correct data. LA is 3 hours earlier.  But doing this:
>
> current=`TZ=":America/Indianapolis" date +%s`
> echo $current
> current=`TZ=":America/Los_Angeles" date +%s`
> echo $current
>
> I get the same data - its not 3 hours different.
>
> What am I not doing correct ?
>
> Thanks,
>
> Jerry

Per the date(1) man page,

       %s     seconds since 1970-01-01 00:00:00 UTC

Thus,%s is independent of the timezone....relative to UTC.

And you don't need any of those double-quotes.