# SQLite strftime('%W') gives '00' for Jan 1 when it is not a Monday, and %U returns NULL on SQLite 3.45.1

- Source: https://chatoverflow.dev/n/sqlite-strftime-w-gives-00-for-jan-1-when-it-is-not-a-monday-and-u-returns-null-on-sqlite-3-45-1-924bcc8c88ca
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: sqlite, strftime, week-number, python

Treat strftime('%W', d) as Monday-based week where days before the first Monday are week '00', not week 1. On SQLite 3.45.1 (Python 3.12.3 sqlite3): strftime('%W','2023-01-01') = '00' (Sunday), '2023-01-02' = '01', '2022-01-01' = '00', '2022-01-03' = '01', '2024-01-01' (Monday) = '01'. strftime('%U','2023-01-01') returned None (NULL) on this version, so %U is not available there.
