DBI::Date.new(year = 0, month = 0, day = 0) DBI::Date.new(Date) DBI::Date.new(Time)
Creates and returns a new DBI::Date object. It's similar to the standard Date class' constructor except that it also accepts a Date or Time object.
# File lib/dbi/utils/date.rb, line 43 def initialize(year=0, month=0, day=0) case year when ::Date @year, @month, @day = year.year, year.month, year.day @original_date = year when ::Time @year, @month, @day = year.year, year.month, year.day @original_time = year else @year, @month, @day = year, month, day end end
Returns a DBI::Date object as a string in YYYY-MM-DD format.
# File lib/dbi/utils/date.rb, line 30 def to_s sprintf("%04d-%02d-%02d", @year, @month, @day) end
Generated with the Darkfish Rdoc Generator 2.