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

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

julianday(time-value, modifier, ...)

Parameters

ParameterDescription
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

Days between two datesTry it yourself
SELECT julianday('2026-03-01') - julianday('2026-01-01') AS days_between;

Output

days_between
59
Years of serviceTry it yourself
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

Was this page helpful?