Guest User

Untitled

a guest
May 26th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007
  2.  
  3. date.to_formatted_s(:db) # => "2007-11-10"
  4. date.to_s(:db) # => "2007-11-10"
  5. date.to_formatted_s(:short) # => "10 Nov"
  6. date.to_formatted_s(:long) # => "November 10, 2007"
  7. date.to_formatted_s(:long_ordinal) # => "November 10th, 2007"
  8. date.to_formatted_s(:rfc822) # => "10 Nov 2007"
  9.  
  10.  
  11. time = Time.now # => Thu Jan 18 06:10:17 CST 2007
  12.  
  13. time.to_formatted_s(:time) # => "06:10:17"
  14. time.to_s(:time) # => "06:10:17"
  15. time.to_formatted_s(:db) # => "2007-01-18 06:10:17"
  16. time.to_formatted_s(:number) # => "20070118061017"
  17. time.to_formatted_s(:short) # => "18 Jan 06:10"
  18. time.to_formatted_s(:long) # => "January 18, 2007 06:10"
  19. time.to_formatted_s(:long_ordinal) # => "January 18th, 2007 06:10"
  20. time.to_formatted_s(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
Add Comment
Please, Sign In to add comment