Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

Date.commercial

Date.commercial([cwyear=-4712[, cweek=1[, cwday=1[, start=Date::ITALY]]]]) → date

Creates a date object denoting the given week date.

The week and the day of week should be a negative or a positive number (as a relative week/day from the end of year/week when negative). They should not be zero.

Example
Date.commercial(2001)     #=> #<Date: 2001-01-01 ...>
Date.commercial(2002)     #=> #<Date: 2001-12-31 ...>
Date.commercial(2001,5,6) #=> #<Date: 2001-02-03 ...>

See also ::jd and ::new.

See also .civil .gregorian_leap? ._httpdate also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0