Sha256: c85546d0a8318921704fc83308391f7e15f4b4617dcab197312444cefe8808da
Contents?: true
Size: 474 Bytes
Versions: 37
Compression:
Stored size: 474 Bytes
Contents
class Time # Returns a new Time created from the ISO date format String "YYYYMMDDhhmmss" def self.from_iso(t) return nil unless t if t.to_s =~ /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/ utc($1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i) else raise ArgumentError, "invalid iso time format: #{t}" end end # Returns the Time as ISO date format String "YYYYMMDDhhmmss" def to_iso getutc.strftime('%Y%m%d%H%M%S') end end
Version data entries
37 entries across 37 versions & 3 rubygems