Class: Time
Overview
Time extensions
Class Method Summary collapse
-
.pack ⇒ Object
Shorthand for Time.now.pack.
-
.stamp ⇒ Object
Shorthand for Time.now.stamp.
Instance Method Summary collapse
-
#pack ⇒ Object
Return time packed into a short string: “YYYYMMDDHHMMSS”.
-
#stamp ⇒ Object
Return a time stamp string in standard format: “YYYY-MM-DD HH:MM:SSZ”.
Class Method Details
Instance Method Details
#pack ⇒ Object
Return time packed into a short string: “YYYYMMDDHHMMSS”
The time is converted to UTC.
Example
Time.now.pack => "20101231125959"
39 40 41 |
# File 'lib/webget_ruby_ramp/time.rb', line 39 def pack getutc.strftime('%Y%m%d%H%M%S') end |
#stamp ⇒ Object
Return a time stamp string in standard format: “YYYY-MM-DD HH:MM:SSZ”
This standard format is specified in IETF RFC 3339 and ISO 8601.
See www.ietf.org/rfc/rfc3339.txt
Example
Time.now.stamp => "2010-12-31 12:59:59Z"
17 18 19 |
# File 'lib/webget_ruby_ramp/time.rb', line 17 def stamp getutc.strftime('%Y-%m-%d %H:%M:%SZ') end |