Module: RailsPdate::Formats::Date

Included in:
PDate
Defined in:
lib/rails_pdate/formats.rb

Constant Summary collapse

FORMATS =
{
    :short        => '%e %b',
    :long         => '%B %e, %Y',
    :db           => '%Y-%m-%d',
    :number       => '%Y%m%d',
    :long_ordinal => lambda { |date|
      day_format = ActiveSupport::Inflector.ordinalize(date.day)
      date.strftime("%B #{day_format}, %Y") # => "April 25th, 2007"
    },
    :rfc822       => '%e %b %Y',
    :iso8601      => lambda { |date| date.iso8601 },
    :default      => '%Y-%m-%d'
}

Instance Method Summary collapse

Instance Method Details

#to_formatted_sObject Also known as: to_s



42
43
44
# File 'lib/rails_pdate/formats.rb', line 42

def to_formatted_s
  strftime(RailsPdate::Formats::Date::FORMATS[:default])
end