Skip to content
instance method

Time#inspect

() -> ::String
inspect → string

Returns a string representation of self with subseconds:

Example
t = Time.new(2000, 12, 31, 23, 59, 59, 0.5)
t.inspect # => "2000-12-31 23:59:59.5 +000001"

Related: Time#ctime, Time#to_s:

Example
t.ctime   # => "Sun Dec 31 23:59:59 2000"
t.to_s    # => "2000-12-31 23:59:59 +0000"

Ruby version changes

  1. 3.2
See also #httpdate #isdst #hour #iso8601 also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0