Sha256: fa237bc92405e6bc287fb7ceb59f41d50ded29f1aef659112dff75b42dcfc46b
Contents?: true
Size: 604 Bytes
Versions: 5
Compression:
Stored size: 604 Bytes
Contents
module Halo module Reach class Util def self.parse_timestamp(timestamp = nil) # Expected format: '/Date(1284497520000-0700)/' # The API returns the date as a UNIX timestamp in milliseconds # The "0700" represents the timezone, in this example the U.S. Pacific (GMT-7) timezone # (http://www.haloreachapi.net/wiki/Date_time_format) if timestamp && (timestamp =~ /^\/Date\((\d+)-(\d+)\)\/$/) return [Time.at($1.to_i / 1000).utc, $2] else raise ArgumentError.new('Invalid timestamp') end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems