SQLite julianday

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

SQLite julianday() function

Description

The SQLite julianday() function returns the Julian day - the number of days since noon in Greenwich on November 24, 4714 B.C.

Syntax

  1. julianday(timestring, modifier, modifier, ...)  

Example-1 :

Compute the number of days since the day of Independence of India.

  1. SELECT julianday('now') - julianday('1947-08-15');  

Here is the result.

julianday('now') - julianday('1947-08-15')
------------------------------------------
24549.5019360879

Example-2 :

Compute the time since the unix epoch in seconds (like strftime('%s','now') except includes fractional part):

  1. SELECT (julianday('now') - julianday('1947-08-15'))*869872.568;  

Here is the result.

(julianday('now') - julianday('1947-08-15'))*869872.568
-------------------------------------------------------
21354952671.2493