Time.parse and some weird defassage with timezone


#1

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?


#2

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)


#3

On Feb 24, 10:49 am, Maurício Linhares removed_email_address@domain.invalid
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’