Week numbers in Bash / Shell
To get the current ISO 8601 week number in Bash / Shell, use the following code snippet:
date +%V
* Ensure your system or application regional settings are set to follow ISO 8601 standards (weeks start on Monday) if the output varies.
Step-by-Step Instructions
- Open a terminal.
- Run: date +%V
- The command prints the ISO 8601 week number (01 to 53) for today.
- For another date use: date -d "2026-01-01" +%V (GNU date).
Good to Know
%V is the ISO week; %U (Sunday-start) and %W (Monday-start, but week 1 begins Jan 1) are different numbering systems. On macOS/BSD, use date -j -f "%Y-%m-%d" "2026-01-01" +%V for a specific date.