0

As the title suggests, I have no idea what's going on. My system's time zone is CST. In Rails' application.rb file, I set the time_zone to CST (-6):

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = 'Central Time (US & Canada)'

But check out this string of commands... pretty self explanatory. The third line (Time.new) is showing up as having a -5 offset (aka Eastern Time)?? However, calling utc_offset shows it being -6 offset (Central, which would be correct)? So confused. help?

2.1.0 :001 > Time.now
 => 2014-12-10 12:10:32 -0600 
2.1.0 :002 > Time.zone.now
 => Wed, 10 Dec 2014 12:10:37 CST -06:00 
2.1.0 :003 > Time.new(2011, 3, 20)
 => 2011-03-20 00:00:00 -0500 
2.1.0 :004 > Time.new(2011, 3, 20).utc_offset
 => -18000 
trevorhinesley
  • 845
  • 1
  • 10
  • 36

1 Answers1

1

This could cause daylight saving. If you take a look at the Dates you are using you will see that the other one:

2.1.0 :003 > Time.new(2011, 3, 20)

is the third week on March and DLS occurs on second sunday in March ( http://www.webexhibits.org/daylightsaving/b.html ).

Miknash
  • 7,888
  • 3
  • 34
  • 46