Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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

by banesong (Acolyte)
on Mar 02, 2010 at 17:46 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-24 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found