Skip to content

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

instance method

Date#inspect

d.inspect → string

Returns the value as a string for inspection.

Example
Date.new(2001,2,3).inspect
          #=> "#<Date: 2001-02-03>"
DateTime.new(2001,2,3,4,5,6,'-7').inspect
          #=> "#<DateTime: 2001-02-03T04:05:06-07:00>"
See also #infinite? #inspect_raw #httpdate #iso8601 also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1