Skip to content

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

instance method

DateTime#to_json

to_json(*args)

Stores class name (DateTime) with Julian year y, month m, day d, hour H, minute M, second S, offset of and Day of Calendar Reform sg as JSON string

See also #to_datetime #to_s #to_date #to_time also in 4.0 · 3.4 · 3.3 · 3.2 · 3.0