Class: DateTime
Overview
Default DATE_FORMATS available
Time::DATE_FORMATS.merge!(
:db => "%Y-%m-%d %H:%M:%S",
:number => "%Y%m%d%H%M%S",
:time => "%H:%M",
:mdy => "%B %d, %Y",
:short => "%d %b %H:%M",
:long => "%B %d, %Y %H:%M"
)
Example Useage
DateTime.now().to_format(:mdy)
Instance Method Summary collapse
-
#to_format(key = :default) ⇒ Object
Helper method for string formatting DateTime.
Instance Method Details
#to_format(key = :default) ⇒ Object
Helper method for string formatting DateTime.
16 17 18 19 20 21 22 |
# File 'lib/doozer/active_support/date_time.rb', line 16 def to_format(key = :default) if format = ::Time::DATE_FORMATS[key] strftime(format) else to_s end end |