Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Help with date:manip

by SBECK (Hermit)
on May 10, 2016 at 13:00 UTC ( #1162625=note: print w/replies, xml ) Need Help??

in reply to Help with date:manip

A few notes:

First off, I see that I definitely need to improve my manual. It's not obvious, if you go right to the document that you can set config variables in two ways. Using the form:

is for the OO interface.  Using the call:
is the functional method (and is described in the document. I will clarify the Config document to mention both in order to avoid this confusion. Sorry for that.

Second, the TZ variable is deprecated, as you note, and will be removed the next release I believe, so you definitely want to use the SetDate config variable.

Third, you did find a bug because "EST" should have returned a timezone (possibly not the one you want) since it is a valid abbreviation, and abbreviations should be parsed as timezones too. I'm in the process of correcting that bug and it'll be fixed in the next release. To be clear, the call:

should have worked (though it would not have produced the correct timezone as described in my next point).

Finally, using EST as a timezone (as was suggested by others) can lead to unpredictable results. For example, I'm in the America/New_York timezone, and if I set TZ=EST (or the equivalent SetDate=now,EST), it sets the timezone to be the America/Panama timezone, because it returns a timezone for which the abbreviation is currently EST. Since the abbreviation is currently EDT in the America/New_York timezone, America/New_York will not be used. As others have suggested, you really want to set the timezone unambiguously using a full timezone name. If you were to use SetDate=DATE,EST it would choose a timezone where EST was the abbreviation on DATE.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2020-10-21 13:50 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (217 votes). Check out past polls.