Module: OEHClient::Helper::Timestamp

Defined in:
lib/oehclient/helper.rb

Class Method Summary collapse

Class Method Details

.to_one_timestamp(timevalue) ⇒ Object

convert the time value from a Time, DateTime, String, or Integer to a proper ONE timestamp value format (UTC Milliseconds)


83
84
85
86
87
88
89
90
91
# File 'lib/oehclient/helper.rb', line 83

def self.to_one_timestamp(timevalue)

	one_timestamp = timevalue												if (timevalue.is_a?(Integer))
	one_timestamp = timevalue.utc.strftime("%s%L").to_i 					if (timevalue.is_a?(Time) || timevalue.is_a?(DateTime))
	one_timestamp = Time.parse(timevalue).utc.strftime("%s%L").to_i 		if (timevalue.is_a?(String))

	one_timestamp

end