class DateTime

Public Instance Methods

localize(options = {}) click to toggle source
# File lib/dm_ruby_extensions/extend_datetime.rb, line 10
def localize(options = {})
  options = {:format => options} if options.class == String      
  I18n.localize(self, options)
end
to_age() click to toggle source
# File lib/dm_ruby_extensions/extend_datetime.rb, line 5
def to_age
  (DateTime.now - self).to_i / 365
end
to_index() click to toggle source

Create a unique sortable index for this date

# File lib/dm_ruby_extensions/extend_datetime.rb, line 17
def to_index
  yday + (year-2000) * 1000
end