Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: why are timegm and timelocal returning the same epoch seconds values

by kehansen (Novice)
on May 14, 2013 at 21:35 UTC ( [id://1033558]=note: print w/replies, xml ) Need Help??


in reply to why are timegm and timelocal returning the same epoch seconds values

Thank you for the responses. Here is more information. I do have "use Time::Local" at the top of my main script. My host is running Solaris 10 and the timezone is set for "US/Pacific". The file I am processing contains multiple(24) timestamps that are in GMT time and we have a customer who wants these times converted to local time.

  • Comment on Re: why are timegm and timelocal returning the same epoch seconds values

Replies are listed 'Best First'.
Re^2: why are timegm and timelocal returning the same epoch seconds values
by vsespb (Chaplain) on May 14, 2013 at 21:57 UTC

    1. Try extract this subroutine from you script and run it outside of your script.

    2. Is your TZ variable set?

    3. Try run with env TZ=US/Pacific

    4. Try run system tools (like 'date) which report time to make sure they recognize timezone correctly

Re^2: why are timegm and timelocal returning the same epoch seconds values
by karlgoethebier (Abbot) on May 15, 2013 at 10:55 UTC

    Update2:

    use DateTime; use DateTime::TimeZone; my $dt = DateTime->new( year => 2013, month => 4, day => 15, hour => 12, minute => 45, second => 47, time_zone => 'Europe/Berlin', ); my $tz = DateTime::TimeZone->new( name => 'US/Pacific' ); my $offset = $tz->offset_for_datetime($dt); print qq($offset\n); print DateTime::TimeZone->offset_as_string( $offset ) . qq(\n); print qq($dt->hour\n); $dt->set_time_zone( 'US/Pacific' ); print qq($dt->hour\n);

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-20 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found