SQLite 3 reference · Date and Time Functions
SQLite JULIANDAY() Function
Return the Julian day number (days since 4714 BC, with a fraction for the time). Subtract two to get days between dates.
SQLite 3
Syntax
julianday(time-value, modifier, ...)
Parameters
| Parameter | Description |
|---|---|
time-value |
A date/time: 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS', 'now', a Julian day number, or a Unix time with the 'unixepoch' modifier. |
modifiers optional |
Adjustments applied left to right, such as '+1 day', '-3 months', 'start of month', 'weekday 1', 'localtime', 'unixepoch'. |
Return value
A real number, or NULL.
Examples
SELECT julianday('2026-03-01') - julianday('2026-01-01') AS days_between;
Output
days_between 59
SELECT name, hire_date,
CAST((julianday('2026-10-22') - julianday(hire_date)) / 365.25 AS INTEGER) AS years_employed
FROM employees
LIMIT 3;
Output
name | hire_date | years_employed Sofia Reyes | 2018-03-01 | 8 Omar Haddad | 2018-06-15 | 8 Mei Chen | 2019-09-01 | 7
In other languages
AGE()· PostgreSQL
Related
UNIXEPOCH()· Return a date/time as a Unix timestamp: whole seconds since 1970-01-01 00:00:00 UTC.TIMEDIFF()· Return the difference between two dates as text like '+0000-01-14 00:00:00.000' (years, months, days, time).DATE()· Return a date as text in YYYY-MM-DD form, optionally shifted with modifiers like '+7 days' or 'start of month'.- SQL Date Functions · tutorial