Soutenez Time.now : Rejoignez notre Plan Premium pour une expérience sans publicité ! Soutenez-nous : Passez Premium sans pub !

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.

Instructions étape par étape

  1. Open a terminal.
  2. Run: date +%V
  3. The command prints the ISO 8601 week number (01 to 53) for today.
  4. For another date use: date -d "2026-01-01" +%V (GNU date).

Bon à savoir

%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.