End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Time#yday
time.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 an integer representing the day of the year, 1..366.
Example
t = Time.now #=> 2007-11-19 08:32:31 -0600 t.yday #=> 323