Re: working around frozen hash




Why don't you change the timezone in the sting beforehand ?

Something like :

date='Fri Jun 20 02:32:28 GST 2008'

=> "Fri Jun 20 02:32:28 GST 2008">> DateTime.parse(date.gsub(' GST ', ' UTC+04 ')).zone

=> "+04:00"
Because that is too easy and makes too much sense ;-) I did not know
about UTC+04 format. That is simple and easy to understand what is
going on. I am not too concern with performance, at this point.
Thanks!


Of course, if you need to pase many dates at many points, you can either
redefine your own parsing routine (def DateTime.myparse(...)), or even
patch the DateTime.parse function with via alias and a new definition...

My thoughts were going into that direction... but I burned myself
going down a similar path for another 'library' before. I didn't
understand enough what I was 'patching' and my fix only cover some
specific cases, for me, but broke other.... I also don't like to mess
around with any code related to time and date. I thought my idea of
just changing a 'constant' in the library, was the less 'intrusive'
way to not change any code 'logic'.

Thanks again
Dany
.



Relevant Pages

  • SUMMARY: Re: DST Patch for Solaris 6 and 7
    ... Sun has an info page at http://www.sun.com/dst/ covering ... you need to be aware of your timezone. ... POSIX timezone format. ... If you use the patch from Terix http://terix.com/dst_registration.htm ...
    (SunManagers)
  • update: timezone offset calc and date formatting
    ... a few days ago I posted on this list about timezone offset calculations. ... Apache uses it's own date format, ... The main performance gain is in the algorithm for calculating the timezone ...
    (comp.lang.perl.misc)
  • Re: how to make dates without timezones?
    ... class, with a unique format on the wire, so that you don't accidentally ... after on a change in timezone. ... access/display the date it is in the same timezone that the server is ... No, make sure it is *always* treated as a specific time zone, regardless ...
    (comp.lang.java.programmer)
  • Re: how to make dates without timezones?
    ... class, with a unique format on the wire, so that you don't accidentally ... seems to me that there should be a strictly CalendarDate class i could ... use for the date types and CalendarTimeStamp class for the timestamp ... after on a change in timezone. ...
    (comp.lang.java.programmer)
  • dateutil 1.4
    ... Prevent tzstr from introducing daylight timings in strings that didn't ... Computing of relative deltas (next month, next year, ... Timezone implementations for tzfileformat ...
    (comp.lang.python.announce)