The Date Class : Date.new « Date « Ruby
- Ruby
- Date
- Date.new
The Date Class
# To create a Date object, use the new method (or its synonym civil).
# You must require the Date class before using it.
# The to_s method returns the date as a string.
require 'date'
date = Date.new( 2006, 11, 8 )
date.to_s # => "2006-11-08"
Related examples in the same category