Iván Cortés Romero Iván Cortés Romero - 8 months ago 42
Ruby Question

yyyy-mm-ddThh:mm:ss.000Z date format in Ruby

I am consuming an API which returns a date like this

. This format is new for me, so, What is the name of this date format? and, how can I treat it in Ruby?


That's an ISO 8601 date and DateTime.parse has no trouble parsing it:

require "date"

str = "2016-05-05T20:59:31.000Z"
p DateTime.parse(str)
# => #<DateTime: 2016-05-05T20:59:31+00:00 ((2457514j,75571s,0n),+0s,2299161j)>