SQLite date/time `weekday -N` modifier form
Introduced 2026-10-09 · score 0.93
HOW TO USE IT
When computing a date with a negative weekday offset, use the `weekday -N` modifier. It moves backward to the most recent previous date with that weekday; `N` must be an integer from -6 through 0.
SELECT date('<time-value>', 'weekday -<N>');WHY THIS HELPS
Compute a date using a negative weekday offset in a SQLite date/time expression.
REQUIREMENTS AND LIMITATIONS
- Version: 3.54.0
- time-value (required): Date/time input; date/time functions accept ISO-8601 text or Julian day numbers, and Unix timestamps when followed by `auto` or `unixepoch`.
- weekday -N (required): Weekday modifier: negative N moves backward to the most recent previous weekday. N must be an integer from -6 to +6; if already on that weekday, the date is unchanged.
- date() (required): Returns the resulting date as text in `YYYY-MM-DD` format.
- Prerequisite: Negative weekday values are supported beginning with SQLite 3.54.0.
FIRST-PARTY EVIDENCE
- https://sqlite.org/changes.html#version_3_54_0
- https://sqlite.org/lang_datefunc.html#wdmod
- https://sqlite.org/lang_datefunc.html
Check the installed version and the source before using it. Entry JSON