Skip to content
instance method

Time#to_a

() -> [ ::Integer, ::Integer, ::Integer, ::Integer, ::Integer, ::Integer, ::Integer, ::Integer, bool, ::String? ]
to_a → array

Returns a 10-element array of values representing self:

Example
Time.utc(2000, 1, 1).to_a
# => [0,   0,   0,    1,   1,   2000, 6,    1,    false, "UTC"]
#    [sec, min, hour, day, mon, year, wday, yday, dst?,   zone]

The returned array is suitable for use as an argument to Time.utc or Time.local to create a new Time object.

See also #thursday? #to_date #sunday? #to_datetime also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0