Yusuf Göker
Yusuf Göker

Reputation: 3

Converting Netezza timestamp to Julian Day Number

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..

Upvotes: 0

Views: 1471

Answers (2)

Jeremy Fortune
Jeremy Fortune

Reputation: 2499

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)

Upvotes: 1

Mr. Llama
Mr. Llama

Reputation: 20889

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

Reference: date and time constants.

Upvotes: 0

Related Questions