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

Time#ctime

time.ctime → string

Returns a canonical string representation of time.

Example
Time.now.asctime   #=> "Wed Apr  9 08:56:03 2003"
Time.now.ctime     #=> "Wed Apr  9 08:56:03 2003"
See also #ceil #day #as_json #dst? also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0