|Keep It Simple, Stupid|
Timezone conversion in Perlby woei (Novice)
|on Dec 27, 2007 at 05:43 UTC||Need Help??|
woei has asked for the
wisdom of the Perl Monks concerning the following question:
I have tried really hard searching for a solution to this problem in many places but have yet to find a satisfactory answer, so I hope someone here can enlighten me.
Currently I have a script that is running on a remote machine (in the States, the localtime of which is the EST), I'd like certain functions to actually execute between a range of times where I am (in South Australian, our timezone is ACST).
I've considered converting the localtime of the host machine to the GMT, then converting that to our timezone (+9.5 hours) but that does not take into account issues like DST which can skew things quite a little.
It'd be great if I can get the Perl script to "sort of" run using our local timezone through some environmental variable, but even then it is still subpar if it is something that is to be employed in a persistent process. Surely there is some method or module that takes in a time specified in EST, and *poof* converts it to ACST?
Is there a more elegant way of doing it?
Another issue that I noticed is on a Solaris box here, typing the 'date' command on the command line actually yields a "CST" timezone, which can be quite ambiguous with the American "CST", is there some way to differentiate the two to perl?