0

I have a following issue - I'm not using config.time_zone, so it should default to my server time zone (if I understand it correctly).

And in my rails console when I do something like

'Oct 12, 2012'.to_datetime 

it returns

Fri, 12 Oct 2012 00:00:00 +0000 

but when I run

'Oct 12, 2012'.to_date.end_of_day

I get the time zone I actually need:

2012-10-12 23:59:59 -0400 

Do you have any ideas why that can happen and how I can get it to work in the same time zone? I found this link - https://rails.lighthouseapp.com/projects/8994/tickets/864-string-to_datetime-doesn-t-take-into-account-timezone-or-second-fractions, but I thought it should be fixed.

Thanks!

Masha
  • 327
  • 1
  • 6
  • 17

1 Answers1

0

It's likely that Rails 2.3.14 will be the end of the line for the Rails 2.3 series unless a major security update is required. This will likely go unpatched.

Maybe using to_date produces different results than to_datetime, so you may be able to work around this somehow.

Don't forget you can also tweak the time-zone of any DateTime object if required.

tadman
  • 208,517
  • 23
  • 234
  • 262