Displaying today's date in plain English

module Ordinalize

  refine Fixnum do

    def ordinalize
      self.to_s + ( (10...20).include?(self) ? 'th' : %w{ th st nd rd th th th th th th }[self % 10] )
    end

  end
end

class DateToday
  using Ordinalize


  def self.to_s
    time = Time.now
    @to_s = time.strftime("%A, #{time.day.ordinalize} %B")
  end

end

puts 'Today is ' + DateToday.to_s

#=> Today is Wednesday, the 24th of February

Resources