[CentOS] Date question

Wed Feb 17 20:00:50 UTC 2021
Jonathan Billings <billings at negate.org>

On Wed, Feb 17, 2021 at 01:57:50PM -0500, 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 ?

Check the man page for 'date'.

%s is "seconds since 1970-01-01 00:00:00 UTC".  Regardless of the time
zone, the time in LA will still be the same number of seconds since
Midnight, January 1st, 1970 in UTC as it was in Indianapolis. 
-- 
Jonathan Billings <billings at negate.org>