Files

OrdinalizedFormatting

Time.now.to_ordinalized_s :long

> “February 28th, 2006 21:10“

Public Instance Methods

strftime_ordinalized(fmt, format=nil) click to toggle source

Gives you a relative date in an attractive format

Parameters

format

strftime string used to format a time/date object

locale<String, Symbol>

An optional value which can be used by localization plugins

Returns

String

Ordinalized time/date object

Examples

   5.days.ago.strftime_ordinalized('%b %d, %Y')     # => 
     # File lib/merb-helpers/date_time_formatting.rb, line 153
153:   def strftime_ordinalized(fmt, format=nil)
154:     strftime(fmt.gsub(/(^|[^-])%d/, '\1_%d_')).gsub(/_(\d+)_/) { $1.to_i.ordinalize }
155:   end
to_ordinalized_s(format = :default) click to toggle source
     # File lib/merb-helpers/date_time_formatting.rb, line 136
136:   def to_ordinalized_s(format = :default)
137:     format = Date.formats[format] 
138:     return self.to_s if format.nil?
139:     strftime_ordinalized(format)
140:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.