TimeZone confusion

I’m using rails 2.3.2.

I have Date/Time data stored in a SQL Server database. All values are
UTC (although the database just stores the time, not the zone). All
of my computers are in the America/New York time zone.

It was my understanding that rails expects a UTC time to come from the
database.

But, it looks like rails assumes that the time value is really local
(in my case, UTC - 5 hours) and converts it by adding 5 hours. Which
is not what I want.

How can I tell rails that the times are UTC and to leave them alone?

How can I tell rails that the times are UTC and to leave them alone?

Put

config.time_zone = ‘UTC’

in your environment.rb. Actually if you look closely, it’s probably
already there, just commented out by default.

  • D

That line was already there, and is not commented.

On Mar 28, 2:22 am, Danny B. [email protected]

Rick S. wrote:

I’m using rails 2.3.2.

But, it looks like rails assumes that the time value is really local
(in my case, UTC - 5 hours) and converts it by adding 5 hours. Which
is not what I want.

How can I tell rails that the times are UTC and to leave them alone?

How are you “looking” at the database values?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs