Skip to content

Instantly share code, notes, and snippets.

@superscott
Created October 16, 2012 03:18
Show Gist options
  • Save superscott/3897081 to your computer and use it in GitHub Desktop.
Save superscott/3897081 to your computer and use it in GitHub Desktop.
Rails Date.today oddity
Ruby 1.9.2 -- Rails 3.2.8
1.9.2p320 :001 > Date.today
=> Mon, 15 Oct 2012
1.9.2p320 :002 > Date.tomorrow
=> Wed, 17 Oct 2012
1.9.2p320 :003 > Date.yesterday
=> Mon, 15 Oct 2012
1.9.2p320 :004 > Time.zone
=> (GMT+00:00) UTC
Ruby 1.9.3 -- Rails 3.2.8
1.9.3p194 :003 > Date.today
=> Mon, 15 Oct 2012
1.9.3p194 :004 > Date.yesterday
=> Mon, 15 Oct 2012
1.9.3p194 :005 > Date.tomorrow
=> Wed, 17 Oct 2012
1.9.3p194 :006 > Time.zone
=> (GMT+00:00) UTC
Ruby 1.9.3 -- Rails 3.2.7
1.9.3p194 :003 > Date.today
=> Mon, 15 Oct 2012
1.9.3p194 :004 > Date.yesterday
=> Mon, 15 Oct 2012
1.9.3p194 :005 > Date.tomorrow
=> Wed, 17 Oct 2012
1.9.3p194 :006 > Time.zone
=> (GMT+00:00) UTC
Ruby 1.8.7 -- Rails 2.3.11
>> Date.today
=> Mon, 15 Oct 2012
>> Date.yesterday
=> Sun, 14 Oct 2012
>> Date.tomorrow
=> Tue, 16 Oct 2012
>> Time.zone.to_s
=> "(GMT+00:00) UTC"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment