Format time as iso8601 : Time format « Time « Ruby






Format time as iso8601


timestamp = '2001-04-17T19:23:17.201Z'
puts t = Time.iso8601(timestamp)    # => Tue Apr 17 19:23:17 UTC 2001
puts t.sec                          # => 17
puts t.tv_usec                      # => 201000

 








Related examples in the same category

1.Format Time as rfc822
2.Format Time as httpdate
3.Time Formatting Directives
4.Format time as: "%A %A %A!" and "%a %a %a!"