Sha256: 919d120ef3ede4dcc2de724aba5ac06091d09decb41c06d3e2fd92a573a6fdc1
Contents?: true
Size: 965 Bytes
Versions: 3
Compression:
Stored size: 965 Bytes
Contents
class Time # unless const_defined?('FORMAT') FORMAT = { :db => "%Y-%m-%d %H:%M:%S", :dbase => "%Y-%m-%d %H:%M:%S", :datbase => "%Y-%m-%d %H:%M:%S", :utc => "%Y-%m-%d %H:%M:%S", :short => "%d %b %H:%M", :long => "%B %d, %Y %H:%M", :day1st => "%d-%m-%Y %H:%M", :dmYHM => "%d-%m-%Y %H:%M", :rfc822 => "%a, %d %b %Y %H:%M:%S %z", nil => "%a %b %d %H:%M:%S %Z %Y" } end # Produce time stamp for Time.now. See #stamp. # # CREDIT: Trans def self.stamp(*args) now.stamp(*args) end # Create a time stamp. # # Time.now.stamp(:short) #=> "01 Dec 15:15" # # Supported formats come from the Time::FORMAT constant. # # CREDIT: Trans def stamp(fmt = nil) unless String === fmt fmt = FORMAT[fmt] end strftime(fmt).strip end # DEPRECATED. # Enhance #to_s by aliasing to #stamp. #alias_method :to_s, :stamp end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-2.2.0 | lib/core/facets/time/stamp.rb |
facets-2.3.0 | lib/core/facets/time/stamp.rb |
facets-2.2.1 | lib/core/facets/time/stamp.rb |