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

Time#asctime

time.asctime → string

Alias of #ctime

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 #ctime #<=> #as_json #- also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1