Printing a Date : to String « Date « Ruby






Printing a Date


require 'date'

puts Time.now.to_s                               # => "Sat Mar 18 19:05:50 EST 2006"
puts DateTime.now.to_s                           # => "2006-03-18T19:05:50-0500"

 

Related examples in the same category