Skip to content

Instantly share code, notes, and snippets.

@teamon
Created July 29, 2013 21:43
Show Gist options
  • Save teamon/6108123 to your computer and use it in GitHub Desktop.
Save teamon/6108123 to your computer and use it in GitHub Desktop.
[59] pry(main)> Date.parse("22-07-2013").to_time
=> 2013-07-22 00:00:00 +0200
[60] pry(main)> Date.parse("22-07-2013").to_time.utc
=> 2013-07-21 22:00:00 UTC
vs
[61] pry(main)> Date.parse("22-07-2013").to_datetime
=> Mon, 22 Jul 2013 00:00:00 +0000
[62] pry(main)> Date.parse("22-07-2013").to_datetime.to_time
=> 2013-07-22 02:00:00 +0200
[63] pry(main)> Date.parse("22-07-2013").to_datetime.to_time.utc
=> 2013-07-22 00:00:00 UTC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment