Created
February 15, 2014 18:31
-
-
Save johno/9023255 to your computer and use it in GitHub Desktop.
The strftime method shows all the Ruby directives for different representations of time. This allows you to deal with tricky scenarios of ambiguous timestamps.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~|||$ irb | |
re2.0.0p353 :001 > require 'Time' | |
=> true | |
2.0.0p353 :002 > Time.strptime("12/22/2011", "%m/%d/%Y") | |
=> 2011-12-22 00:00:00 -0700 | |
2.0.0p353 :003 > Time.strptime("12/11/2011", "%m/%d/%Y") | |
=> 2011-12-11 00:00:00 -0700 | |
2.0.0p353 :004 > Time.strptime("12/11/2011", "%d/%m/%Y") | |
=> 2011-11-12 00:00:00 -0700 | |
2.0.0p353 :005 > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment