Module: Nexpose::ISO8601
- Defined in:
- lib/nexpose/util.rb
Overview
Function module for converting to ISO 8601 and UTC dates expected by 2.0 API.
Class Method Summary collapse
-
.to_string(time = Time.now) ⇒ String
Convert a time object into a UTC ISO 8601 basic date-time format.
-
.to_time(time_string) ⇒ Time
Convert a string representation into a Time object.
Class Method Details
.to_string(time = Time.now) ⇒ String
Convert a time object into a UTC ISO 8601 basic date-time format.
105 106 107 |
# File 'lib/nexpose/util.rb', line 105 def to_string(time = Time.now) time.to_time.utc.strftime('%Y%m%dT%H%M%S.%LZ') end |
.to_time(time_string) ⇒ Time
Convert a string representation into a Time object.
96 97 98 |
# File 'lib/nexpose/util.rb', line 96 def to_time(time_string) Time.strptime(time_string.to_s, '%Y%m%dT%H%M%S.%L%Z') end |