Oracle Julian day of year

Prmejc picture Prmejc · Jul 16, 2014 · Viewed 18.8k times · Source

how can I select Julian day of year in Oracle database?

I tried: select to_char(sysdate, 'J') from dual; Which gives me the number of days since January 1, 4712 BC. But I would need the number of days since 1.1. of current year.

Answer

Álvaro González picture Álvaro González · Jul 16, 2014

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)