Convert calender date (YYYY-MM-DD) to julian date

General
Enthusiast

Convert calender date (YYYY-MM-DD) to julian date

Hi All,

Could you please help me with a query with which i can convert a date value (YYYY-MM-DD) in to julian date format YYYYDDD.

Thanks

Jaganna

3 REPLIES
Enthusiast

Re: Convert calender date (YYYY-MM-DD) to julian date

Hi, 

You can cast it like this:

SELECT CURRENT_DATE (DATE, FORMAT 'YYYYDDD');

 *** Query completed. One row found. One column returned.

 *** Total elapsed time was 1 second.

Current Date

------------

     2014260

HTH

-Jerico

Enthusiast

Re: Convert calender date (YYYY-MM-DD) to julian date

Hi Jerico,

Thanks a lot for your input, however i didnt get the same result while executing the query. In fact the format appears as  2014-09-07 as mentioned below. Am i doing something wrong here, please advice.

SELECT CURRENT_DATE (DATE, FORMAT 'YYYYDDD');

2014-09-17

Regards

Jaganna

Enthusiast

Re: Convert calender date (YYYY-MM-DD) to julian date

Jerico ... thanks a lot again ... found below query to work as expected.

select current_date (format 'yyyyddd') (char(7));