user2627144 user2627144 - 4 months ago 11
SQL Question

Oracle Julian day of year

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.


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)