Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Time#wday
wday → integer
time.c
View on GitHub ↗
static VALUE
time_wday(VALUE time)
{
struct time_object *tobj;
GetTimeval(time, tobj);
MAKE_TM_ENSURE(time, tobj, tobj->vtm.wday != VTM_WDAY_INITVAL);
return INT2FIX((int)tobj->vtm.wday);
}
Returns the integer day of the week for self, in range (0..6), with Sunday as zero.
Example
t = Time.new(2000, 1, 2, 3, 4, 5, 6) # => 2000-01-02 03:04:05 +000006 t.wday # => 0 t.sunday? # => true