htmanning has asked for the wisdom of the Perl Monks concerning the following question:

I have a timestamp in the database that is EST because that's where the server is. It is in a format like: 2019-08-07 17:51:46. I need to convert it to also show PST. I'm not sure how to go about this. Any ideas? I tried messing with Date::Parse but I'm not sure how to account for the times when it's a different day in EST.

Replies are listed 'Best First'.
Re: Changing Timestamp Around
by holli (Abbot) on Aug 07, 2019 at 23:08 UTC
    D:\ENV>perl -MDateTime -e "print DateTime->new( year=>2000, day=>1, mo +nth=>1, hour=>12, time_zone=> 'America/Cancun' )->set_time_zone('Amer +ica/Los_Angeles')->hour;" 10
    See DateTime::TimeZone.


    holli

    You can lead your users to water, but alas, you cannot drown them.