Mega Code Archive

 
Categories / Ruby / Date
 

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"