botdeveloper
botdeveloper

Reputation: 11

Convert Julian Date to Normal System Date in Silverlake(USing SQL statement)

I am trying to convert Julian Date to Gregorian/Normal Date(mm/dd/yyyy) in SilverLake DB.

I am using Oracle SQL statements to query SilverLake db. I tried it with:

TO_CHAR(<myfieldname>,'YYYYDDD')

But SilverLake DB is throwing me an error:

Argument 1 is not valid for TO_CHAR function

Would appreciate your help. Thanks in advance.

Upvotes: 1

Views: 1245

Answers (2)

Peter
Peter

Reputation: 11

I am not allowed to post a reply to the previous comment since I am a new user, but this answer also responds there. What you refer to as SilverLake DB is actually a specific vendor implementation (Jack Henry & Associates) of the Db2 for i database, for their SilverLake core banking system. This is the database that comes with the IBM iSeries, a midrange computer also known with it's older name AS/400 (think of a mainframe, just smaller). While antiquated this is still used for legacy reasons, especially in banking systems such as SilverLake.

ORACLE specific commands will NOT work there, other than by coincidence of IBM also using them, and any research you are doing should be referring to Db2 for i, I doubt you will find much content for SilverLake specifically unless you reach to the vendor directly.

I have had luck with the following statement with what you are trying to do:

COGSUP.JDTODATE(<myfieldname>)

this will convert the data type to an ISO Date format, in my humble opinion this should be the only date format used on databases.

If you still need to convert this to the American notation for presentation purposes, you can wrap this with a to_char statement:

to_char(COGSUP.JDTODATE(<myfieldname>), 'MM/DD/YYYY')

Upvotes: 1

GMB
GMB

Reputation: 222582

Just use to_date() to turn the julian date to a date:

to_date(col, 'j')

Then if you need to represent the date in a given format, you can use to_char():

to_char(to_date(col, 'j'), 'mm/dd/yyyy')

Upvotes: 0

Related Questions