TimeZone confusion


#1

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?


#2

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

#3

That line was already there, and is not commented.

On Mar 28, 2:22 am, Danny B. removed_email_address@domain.invalid


#4

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?