JULIANDAY

JULIANDAY is an SQL function that converts a date or datetime expression into Julian day number, representing the number of days since November 24, 4714 BC, in the Julian calendar. The result is a real number that includes fractions of a day.

JULIANDAY(date, [modifier, […]])

  • date: This parameter is used to specify the date that needs to be converted to the Julian day. The date can be in any format that SQLite’s date and time functions can understand.
  • modifier: This is an optional parameter that allows you to modify the date before it’s converted to the Julian day. Multiple modifiers can be provided if required, each directing SQLite to alter the date in a specific manner before the conversion process is initiated. Popular modifiers include ‘localtime’, ‘utc’, ‘start of month’, ‘end of month’, ‘weekday 0’ etc. Modifiers are applied to the date in the order they are entered.

Example

SELECT JULIANDAY('1992-11-24');

Output

2448929.5

Explanation

In the example, the JULIANDAY function converts the date ‘1992-11-24’ into a Julian day number. The output returns the Julian day - the number of days since noon in Greenwich on November 24, 4714 B.C.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.