in reply to Re: setting TZ causes Date::Manip to report incorrect time
in thread setting TZ causes Date::Manip to report incorrect time

I appreciate the helpful reply with information about the DateTime project. However, it doesn't seem to answer questions like:

I feel like you ignored my original post. :(

the DateTime modules solve pretty much any problem to do with dates and times in perl

Good to know. What about parsing the date 'today'? How is that affected by time zones? Which of the plethora of DateTime modules should I use to parse 'today' and format it as 'Tue Sep 9 12:12:12 PDT 2003'?

---
"A Jedi uses the Force for knowledge and defense, never for attack."
  • Comment on Re: Re: setting TZ causes Date::Manip to report incorrect time

Replies are listed 'Best First'.
Re: Re: Re: setting TZ causes Date::Manip to report incorrect time
by autarch (Hermit) on Sep 09, 2003 at 19:56 UTC

    Valid values for the TZ variable when using DateTime are anything that matches a valid Olson time zone name, like "America/Chicago". When using Date::Manip they're whatever the Date::Manip docs say are valid. See the "TIMEZONES" section of the docs.

    Why did Date::Manip behave as you described? Presumably there's a bug in Date::Manip, or your expectations are wrong and Date::Manip can't do what you want.

    How often do you need to parse things like "today" and "two days after tomorrow" anyway? With DateTime, for just getting "today" you'd do DateTime->today(). To format it as above you'd do $dt->strftime('%a %b %e %H:%M:%S %Z %Y'). However, you're strongly discouraged from using short time zone names like "PDT" for anything but display, because they are not unique.

Re: Re: Re: setting TZ causes Date::Manip to report incorrect time
by BigLug (Chaplain) on Sep 10, 2003 at 04:04 UTC
    I appreciate the helpful reply with information about the DateTime project. However, it doesn't seem to answer questions like:

    * What are valid values for the TZ environment variable?
    * Why did Date::Manip behave as I described?

    I feel like you ignored my original post. :(

    Sorry you feel that way, however I was trying to answer your question by offering a solution, rather than just straight answering your question.

    Your question was "Does anyone know what's going on with Date::Manip?" The answer to which is 'no', see below. As to the questions in your reply:

    * What are valid values for the TZ environment variable?
    This is not a perl question but one which should be addressed to your operating system. However if you're looking for valid values for Date::Manip, I'd check their POD or even their source. Remember however that if you specify PDT or -0700 (assuming Date::Manip accepts these values) then you will not get any daylight savings information and the number of hours between June 30 and Dec 31 will be a multiple of 24.

    * Why did Date::Manip behave as I described?
    It looks like there's either a bug in D:M or it's a feature you're not using properly. I'm guessing that it's a bug because I can't make sense of it as a feature.

      Sorry you feel that way, however I was trying to answer your question by offering a solution, rather than just straight answering your question.

      Fair enough. I've taken a look at the DateTime project and it looks great. How does it compare performance wise to other date manipulation modules like Date::Manip, Date::Parse/Date::Format, and Time::ParseDate?

      * What are valid values for the TZ environment variable? This is not a perl question but one which should be addressed to your operating system.

      Sure, the OS is in chare of the environment, but this is absolutely a Perl question since Date::Manip relies on the environment settings to know how it should parse and format dates.

      ---
      "A Jedi uses the Force for knowledge and defense, never for attack."