Week 32 is from Monday, August 7th, 2023 until (and including) Sunday, December 26, 2021.
Week number according to the ISO-8601 standard, weeks starting on Monday. The first week of the year is the week that contains that year's first Thursday (='First 4-day week'). ISO representation: 2021-W51
The highest week number in a year is either 52 or 53. 2021 has 52 weeks.
ISO 8601 is not the only week numbering system in the world, other systems use weeks starting on Sunday (US) or Saturday (Islamic).
1 2 3 4 5 6 7let gregorian = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian)! gregorian.firstWeekday = 2 // Monday gregorian.minimumDaysInFirstWeek = 4 let components = gregorian.components(.WeekOfYearCalendarUnit | .YearForWeekOfYearCalendarUnit, fromDate: date) let week = components.weekOfYear let year = components.yearForWeekOfYear
1week_number = Time.now.strftime("%U")
Replace Time.now with Time.local(year,month,day) for other dates. Formats: %U - Week number of the year, starting with the first Sunday as the first day of the first week (00..53) %V - Week number of year according to ISO-8601 (01..53) %W - Week number of the year, starting with the first Monday as the first day of the first week (00..53)
1year, week := time.Now().ISOWeek()
Linux/Unix shell (bash)
Returns the ISO-8601 week number. Other formats under 'Ruby'. More details in the Linux Programmer's Manual