Skip to content

Instantly share code, notes, and snippets.

@tanelsuurhans
Created May 12, 2011 20:43
Show Gist options
  • Save tanelsuurhans/969400 to your computer and use it in GitHub Desktop.
Save tanelsuurhans/969400 to your computer and use it in GitHub Desktop.
Date and time inconsistencies
ruby-1.9.2-p180 :005 > Date.today.to_time
=> 2011-05-12 00:00:00 +0300
ruby-1.9.2-p180 :006 > Date.today.to_datetime
=> Thu, 12 May 2011 00:00:00 +0000
ruby-1.9.2-p180 :007 > Date.today.to_time_in_current_zone
=> Thu, 12 May 2011 00:00:00 EDT -04:00
ruby-1.9.2-p180 :008 > Time.zone
=> (GMT-05:00) Eastern Time (US & Canada)
ruby-1.9.2-p180 :009 > Time.now
=> 2011-05-12 23:43:28 +0300
ruby-1.9.2-p180 :010 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment