class Time #:nodoc: # 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