0

I have been looking for it during days but could not find how to do..

It is like:

select to_number(to_char('2015-06-24 00:00:00','J')) on Oracle.

I need to find the Julian Numeric Day value, not to be confused with the ordinal date of the year..

Damian Yerrick
  • 4,602
  • 2
  • 26
  • 64

2 Answers2

1

Conversion templates indicate that 'J' is exactly what you want.

I think the issue you have is the to_number() function, not the to_char() function. Use casts instead.

SYSTEM(ADMIN)=> select to_char('2015-06-24 00:00:00'::timestamp,'J')::int;
 ?COLUMN?
----------
  2457198
(1 row)
Jeremy Fortune
  • 2,459
  • 1
  • 18
  • 21
0

You need to use the DDD (day of year) date identifier in TO_CHAR.

Reference: date and time constants.

Mr. Llama
  • 20,202
  • 2
  • 62
  • 115