Sha256: 4427e4eb0abc41993b39c288fa4de26efbff3f52c4a6d8130793a09067fdf35c
Contents?: true
Size: 639 Bytes
Versions: 1
Compression:
Stored size: 639 Bytes
Contents
require 'time' class Time DATE_FORMATS = { :db => "%Y-%m-%d %H:%M:%S", :number => "%Y%m%d%H%M%S", :time => "%H:%M", :short => "%d %b %H:%M", :long => "%B %d, %Y %H:%M", :long_ordinal => lambda { |time| time.strftime("%B #{time.day.ordinalize}, %Y %H:%M") }, :rfc822 => lambda { |time| time.strftime("%a, %d %b %Y %H:%M:%S #{time.formatted_offset(false)}") } } def to_formatted_s(format = :default) return to_default_s unless formatter = DATE_FORMATS[format] formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cwyckoff-rosetta_queue-0.3.3 | lib/rosetta_queue/core_ext/time.rb |