SQLite DATE() Function
Definition and Usage
The DATE() function returns a date as a text in the format YYYY-MM-DD. Modifiers can add or subtract time.
Tip: Also look at TIME(), DATETIME(), STRFTIME().
Syntax
DATE(time_value, modifier, ...)
Parameter Values
| Parameter | Description |
|---|---|
| time_value | Required. A date or time, like '1996-07-04', '1996-07-04 14:30:00' or 'now' |
| modifier | Optional. Modifiers that change the date or time, like '+7 days', '-1 month', 'start of month', 'start of year', 'weekday 0' (the next Sunday) and 'localtime' |
Technical Details
| Return type: | Text |
|---|
More Examples
Example
Return the date 30 days after each order:
SELECT OrderID, OrderDate,
DATE(OrderDate, '+30 days')
FROM Orders;
Try it Yourself »