date
SQLite 3.x+→ TEXTReturns the date portion of a time value as a TEXT string in YYYY-MM-DD format. If no arguments are given, returns the current UTC date. Equivalent to strftime('%F', TIME_VALUE, ...).
Signature
date(TIME_VALUE, MODIFIER, ...)Parameters
| Parameter | Type | Description |
|---|---|---|
| TIME_VALUE | TEXT | REAL | INTEGER | Optional. A time value as ISO-8601 text (e.g. '2025-06-15'), a Julian day number (REAL), or the special string 'now'. Defaults to 'now' if omitted. |
| MODIFIER | TEXT | Optional, repeatable. One or more modifiers applied left-to-right, such as '+7 days', '-1 month', 'start of month', 'start of year', 'start of day', 'weekday N', 'localtime', 'utc'. |
Examples
Current UTC date — TIME_VALUE defaults to 'now' when omitted
SELECT date();'2025-06-15'Date 30 days from today — useful for expiry or deadline calculations
SELECT date('now', '+30 days');'2025-07-15'Last day of the current month — chain modifiers for compound calculations
SELECT date('now', 'start of month', '+1 month', '-1 day');'2025-06-30'First day of the current year
SELECT date('now', 'start of year');'2025-01-01'Calculate a 90-day window from a stored ISO-8601 date column
SELECT date(created_at, '+90 days') FROM orders WHERE id = 1;'2025-09-13'Saving dates as '15/06/2025' or '06-15-2025' is a common mistake. SQLite's date(), datetime(), and strftime() only parse ISO-8601 input ('YYYY-MM-DD'), so every date function call on such a column silently returns NULL. Lexicographic sorting also breaks — '09/2025' sorts before '01/2026' incorrectly.
✓ Instead: Always store dates as 'YYYY-MM-DD' TEXT so that SQLite date functions accept them directly and ORDER BY yields correct chronological results.
Internally, date(X, mods...) is exactly strftime('%F', X, mods...). The dedicated function is faster and more readable. Use 'start of month' plus '+1 month' plus '-1 day' to find the last day of any month — a pattern not available via a single modifier.
SQLite has no dedicated DATE column type. Dates are stored as TEXT (ISO-8601), REAL (Julian day numbers), or INTEGER (Unix timestamps) — the column type is merely a hint. This contrasts with PostgreSQL, which has a true DATE type, CURRENT_DATE, and the AT TIME ZONE operator. Always store dates in ISO-8601 format ('YYYY-MM-DD') in TEXT columns so that lexicographic ordering matches chronological ordering.