Module ActiveSupport::CoreExtensions::Date::Conversions
In: vendor/activesupport/lib/active_support/core_ext/date/conversions.rb

Getting dates in different convenient string representations and other objects

Methods

Public Instance methods

To be able to keep Dates and Times interchangeable on conversions

[Source]

    # File vendor/activesupport/lib/active_support/core_ext/date/conversions.rb, line 21
21:         def to_date
22:           self
23:         end

[Source]

    # File vendor/activesupport/lib/active_support/core_ext/date/conversions.rb, line 12
12:         def to_formatted_s(format = :default)
13:           case format
14:             when :default then to_default_s
15:             when :short   then strftime("%e %b").strip
16:             when :long    then strftime("%B %e, %Y").strip
17:           end
18:         end

[Source]

    # File vendor/activesupport/lib/active_support/core_ext/date/conversions.rb, line 25
25:         def to_time(form = :local)
26:           ::Time.send(form, year, month, day)
27:         end

[Validate]