this week is…
week 42 is from Monday, October 17, 2022 to Sunday, October 23, 2022 (included).
week number according to the iso-8601 standard, weeks starting from Monday. the first week of the year is the week that contains the first Thursday of that year (=’first 4-day week’). iso rendering: 2022-w42
the highest week number in a year is 52 or 53. 2022 has 52 weeks.
iso 8601 is not the only week numbering system in the world, other systems use weeks starting on Sunday (American) or Saturday (Islamic).
week number lists by year: 2021 – 2022 – 2023 – 2024 …
programming routines
microsoft excel/libreoffice calc
where return type ’21’ is iso-8601 (week starting Monday). in excel 2007, your best choice is week number (today(), 2) (2 = week starting on monday). weeknum(today()) will return the week number with weeks starting from Sunday (return type = 1).
google docs spreadsheet
the type (here ’21’) is compatible with excel/libreoffice, 21 is iso-8601
php
or date(“w”, epoch) for other week numbers. remember to use uppercase ‘w’ and not ‘w’.
python
pearl
replace the time with other epoch/unix timestamps for other week numbers.
java
use week_of_year in the calendar class. more information about stack overflow
javascript
extend the date class using the code above.
c#
see iso-8601 update on stack overflow
mysql
replace now() with other dates, eg. select week of year(‘2022-02-20’); (you can also use the week function with mode=3 select week(now(),3))
postgresql
mssql
oracle
iw: week of the year (1-52 or 1-53) according to the iso-8601 standard. ww: week of the year (1-53) where week 1 starts on the first day of the year and continues until the seventh day of the year (mostly not used)
sql string
iphone/mac
iphone/ios/swift
r
ruby
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 – iso-8601 week number of the year (01..53) %w – week number of the year, starting with the first Monday as the first day of the first week (00..53)
go
inside linux/unix (bash)
returns the iso-8601 week number. other formats under ‘ruby’. more details in the linux programmer’s manual
luah
formats: see formats in ‘ruby’.
windows powershell
x++ (microsoft dynamics axe)
c/al (microsoft dynamic navigation):
Thanks to everyone who sent me fixes and updates!