week-number ( timestamp -- [1,53] )
Calendar ยป Calendar facts

Prev:day-of-week ( timestamp -- n )
Next:julian-day-number ( $year $month $day -- n )


Vocabulary
calendar

Inputs
timestampa timestamp


Outputs
[1,53]an integer


Word description
Calculates the ISO 8601 week number from 1 to 53 (leap years). Weeks start on Monday and end on Sunday. The end of December can sometimes be the first week of the next year and January can be the last week number of the previous year. See https://en.wikipedia.org/wiki/ISO_week_date

Examples
Last day of 2018 is already in the first week of 2019.
USING: calendar prettyprint ; 2018 12 31 <date> week-number .
1

2020 is a leap year with 53 weeks, and January 1st, 2021 is still in week 53 of 2020.
USING: calendar prettyprint ; 2021 1 1 <date> week-number .
53


Definition