Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: How to set a processes notion of the timezone on win32?

by banesong (Acolyte)
on Mar 02, 2010 at 17:46 UTC ( #826215=note: print w/replies, xml ) Need Help??

in reply to How to set a processes notion of the timezone on win32?

I had a similar problem with an application that had to return local times for multiple timezones. An easy enough way to do this is to use the DateTime module. To convert a known time to another time, you can use:
my $oldDate = DateTime->new(month=>$monthVar, day=>$dayVar, year=>$yearVar, hour=>$hourVar, minute=>$minuteVar, time_zone=>'local'); $dateObject = $oldDate->clone()->set_time_zone('UTC'); $dateObject =~ s/T/ /; print &UnixDate($dateObject,"%m/%d/%Y %H:%M")
In order to just get the current date/time in UTC format, you can use:
$dateObject = DateTime->now(time_zone=>'UTC'); print $dateObject;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://826215]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2017-10-23 05:38 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (277 votes). Check out past polls.