Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Date#iso8601

iso8601 → string

Equivalent to strftime with argument '%Y-%m-%d' (or its shorthand form '%F');

Example
Date.new(2001, 2, 3).iso8601 # => "2001-02-03"

Date#xmlschema is an alias for Date#iso8601.

See also .iso8601 #inspect #italy #infinite? also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0