Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (14)
As of 2016-10-27 14:28 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (364 votes). Check out past polls.