Skip to content

Instantly share code, notes, and snippets.

@amuino
Created March 30, 2011 22:16
Show Gist options
  • Save amuino/895427 to your computer and use it in GitHub Desktop.
Save amuino/895427 to your computer and use it in GitHub Desktop.
Rails does really funny things in the late hours
# It is 00:15
ruby-1.9.2-p180 :025 > Time.now
=> 2011-03-31 00:15:10 +0200
# Today is 31st of March
ruby-1.9.2-p180 :023 > Date.today
=> Thu, 31 Mar 2011
# Yesterday was 29 of March ????? WTF!!!
ruby-1.9.2-p180 :024 > Date.yesterday
=> Tue, 29 Mar 2011
# Any of these works:
ruby-1.9.2-p180 :042 > Date.today.prev_day
=> Wed, 30 Mar 2011
ruby-1.9.2-p180 :044 > Date.today - 1.day
=> Wed, 30 Mar 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment