Created
May 25, 2010 12:30
-
-
Save spp/413074 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 | |
| date.to_formatted_s(:db) # => "2007-11-10" | |
| date.to_s(:db) # => "2007-11-10" | |
| date.to_formatted_s(:short) # => "10 Nov" | |
| date.to_formatted_s(:long) # => "November 10, 2007" | |
| date.to_formatted_s(:long_ordinal) # => "November 10th, 2007" | |
| date.to_formatted_s(:rfc822) # => "10 Nov 2007" | |
| time = Time.now # => Thu Jan 18 06:10:17 CST 2007 | |
| time.to_formatted_s(:time) # => "06:10:17" | |
| time.to_s(:time) # => "06:10:17" | |
| time.to_formatted_s(:db) # => "2007-01-18 06:10:17" | |
| time.to_formatted_s(:number) # => "20070118061017" | |
| time.to_formatted_s(:short) # => "18 Jan 06:10" | |
| time.to_formatted_s(:long) # => "January 18, 2007 06:10" | |
| time.to_formatted_s(:long_ordinal) # => "January 18th, 2007 06:10" | |
| time.to_formatted_s(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment