Oracle Julian day of year Oracle Julian day of year sql sql

Oracle Julian day of year


If you check the TO_CHAR (datetime) documentation you get a link to "Format Models" with a comprehensive list of available formats. I guess you want this:

DDD Day of year (1-366)


SELECT TO_CHAR(SYSDATE, 'DDD') from DUAL;


One way would be to use:

select sysdate - trunc(sysdate,'yyyy') from dual

'Trunc' cuts everything except the year and returns 01/01/2014, subtracted by the sysdate returns numbers of days since 1st of january.