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.
104 105 106 |
# File 'lib/nexpose/util.rb', line 104 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.
95 96 97 |
# File 'lib/nexpose/util.rb', line 95 def to_time(time_string) Time.strptime(time_string.to_s, '%Y%m%dT%H%M%S.%L%Z') end |