Hi, I have a strange case, my system clock is set to utc and eastern time (-5) rails is configured to use eastern time timestamps on the database work as expected, meaning they are stored in utc but by hand time entries are 2 hours behind, (why on earth two?) i.e Time.parse("2008-02-24 4 pm") will return Tue Feb 24 16:00:00 -0500 2009 but will store it in the database as 19:00 instead of 21:00 hrs (utc speaking) Any clues?
Maurício Linhares
2009-Feb-24 16:49 UTC
Re: Time.parse and some weird defassage with timezone
What happens if you do this: puts( Time.parse("2008-02-24 4 pm").utc ) Do you get the correct UTC time? - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Tue, Feb 24, 2009 at 1:01 PM, Andres Paglayan <andres-pMggkaTgBv1Wk0Htik3J/w@public.gmane.org> wrote:> Hi, > > I have a strange case, > my system clock is set to utc and eastern time (-5) > > rails is configured to use eastern time > > timestamps on the database work as expected, > meaning they are stored in utc > > but by hand time entries are 2 hours behind, (why on earth two?) > > i.e > Time.parse("2008-02-24 4 pm") will return Tue Feb 24 16:00:00 -0500 2009 > but will store it in the database as 19:00 instead of 21:00 hrs (utc > speaking) > > > Any clues? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 24, 10:49 am, Maurício Linhares <mauricio.linha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> What happens if you do this: > > puts( Time.parse("2008-02-24 4 pm").utc ) > > Do you get the correct UTC time? >Brigado Mauricio for the replay, yep, this was on scraped data, ashamed to say that I wasn''t checking its integrity, when i got the data like this: yyyy-mm-ddhh_mm (without space between dd and hh), interestingly enough, after 2,200 parses the parser starts the 2 hour drift, (I am making sure that the date string comes properly formatted now) but still, an interesting ''feature'' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---