[SQL]How to calculate "Julian day"

2014-04-28



select julian_day(current_date)-julian_day('2011-12-31')
from any files

-or the first date of year and then + 1                                   
select julian_day(current_date)-julian_day('2012-01-01') + 1
from any files

If files have over 1 row to be appealed, added DISTINCT before Julian_day
select DISTINCT julian_day(current_date)-julian_day('2011-12-31')
from any files

-or the first date of year and then + 1                                   
select DISTINCT julian_day(current_date)-julian_day('2012-01-01') + 1
from any files
----------------------------------------------------------------------------------------------

Because Julian Day is representing a number of days from January 1, 4713 B.C.

Newer Older