Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Time#yday
yday → integer
time.c
View on GitHub ↗
static VALUE
time_yday(VALUE time)
{
struct time_object *tobj;
GetTimeval(time, tobj);
MAKE_TM_ENSURE(time, tobj, tobj->vtm.yday != 0);
return INT2FIX(tobj->vtm.yday);
}
Returns the integer day of the year of self, in range (1..366).
Example
Time.new(2000, 1, 1).yday # => 1 Time.new(2000, 12, 31).yday # => 366