Re: working around frozen hash
- From: Dany <danyc18@xxxxxxxxx>
- Date: Mon, 30 Jun 2008 12:40:27 -0700 (PDT)
Because that is too easy and makes too much sense ;-) I did not know
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"
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!
My thoughts were going into that direction... but I burned myself
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...
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
.
- References:
- working around frozen hash
- From: Dany
- Re: working around frozen hash
- From: F. Senault
- working around frozen hash
- Prev by Date: Re: working around frozen hash
- Next by Date: Re: working around frozen hash
- Previous by thread: Re: working around frozen hash
- Next by thread: Re: working around frozen hash
- Index(es):
Relevant Pages
|