[CentOS] Date question

Thu Feb 18 13:23:10 UTC 2021
Jerry Geis <jerry.geis at gmail.com>

On Wed, Feb 17, 2021 at 1:57 PM Jerry Geis <jerry.geis at gmail.com> 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
>


Hi All - I did figure this out. I was close the first time - but just not
right.

FROM_DATE_TIME=`TZ="America/Los_Angeles" date --date '120 sec ago'
+'%Y-%m-%d %H:%M:%S'`
TO_DATE_TIME=`TZ="$America/Los_Angeles" date --date '1 sec ago' +'%Y-%m-%d
%H:%M:%S'`

and my server is set for Indianapolis time. The above worked.
Thanks!

Jerry