Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Changing Timestamp Around

by htmanning (Friar)
on Aug 07, 2019 at 22:51 UTC ( [id://11104121]=perlquestion: print w/replies, xml ) Need Help??

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11104121]
Approved by holli
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-24 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found