SQLite TIMEDIFF() Function
Example
Return the time between two dates:
SELECT TIMEDIFF('1997-02-12', '1996-07-04');
Try it Yourself »
Definition and Usage
The TIMEDIFF() function returns the time between two dates as a text in the format +YYYY-MM-DD HH:MM:SS.SSS. The result is the first date minus the second date.
Tip: Also look at JULIANDAY().
Syntax
TIMEDIFF(time_value1, time_value2)
Parameter Values
| Parameter | Description |
|---|---|
| time_value1 | Required. A date or time |
| time_value2 | Required. The date or time to subtract |
Technical Details
| Return type: | Text |
|---|---|
| Works in: | SQLite 3.43.0 and later |