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#wday

time.wday → integer

Returns an integer representing the day of the week, 0..6, with Sunday == 0.

Example
t = Time.now   #=> 2007-11-20 02:35:35 -0600
t.wday         #=> 2
t.sunday?      #=> false
t.monday?      #=> false
t.tuesday?     #=> true
t.wednesday?   #=> false
t.thursday?    #=> false
t.friday?      #=> false
t.saturday?    #=> false
See also #utc_offset #wednesday? #utc? #xmlschema also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0