Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Determining Daylight Savings Timeby Starky (Chaplain) |
on May 29, 2002 at 21:20 UTC ( [id://170223]=perlquestion: print w/replies, xml ) | Need Help?? |
Starky has asked for the wisdom of the Perl Monks concerning the following question:
Is there a way to determine whether a given date in an arbitrary time zone occurs during daylight savings time (e.g., when you have something like the number of epoch seconds given by a client's time() call such as 1022704935, or perhaps just a date string such as '2002-05-29 08:00:00', and the client is in MST7MDT) other than a convoluted procedure involving localtime()[8]?
I have searched the CPAN, but to no avail. And using localtime has provided me with nothing but frustration, since (so far as I can tell) the only way to determine whether it is daylight savings time in a particular time zone is:
The reason for dealing with the offset is that localtime() likes to adjust the return value according to the offset between the machine's time zone and that given by $ENV{TZ}: yields Even Date::Manip likes to implicitly convert epoch seconds. For example, gives
It just seems to be an overly convoluted process. I'm convinced there's an easier way but cannot seem to find it. I feel like I'm just being daft here or there's something about time zones I'm simply not clued in to ... Edit by tye to change PRE tags to CODE tags
Back to
Seekers of Perl Wisdom
|
|