Julian Date to YYYYMMDD

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Julian Date to YYYYMMDD

Post by shrey3a »

Hi,

I've date coming from DB2-AS400 as Julian . I'm able to succefully convert dates with using Functions

Ans=Oconv(Iconv(TheDate, "DYJ"), "D-YMD[4,2,2]")

But I've dates coming in format 104314 i.e. 2004-11-09 for which above routine do not works.

Can someone suggest how to convert the dates in this format.

Regards,
Munish
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Please post this on the DataStage forum. This forum is to discuss topics in, or desirable to be in, the FAQ forum. The DataStage forum is where you get help on specific questions.
One you post there we'll answer you there. Not being a moderator I can not transfer your message to the other forum.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You need to find out the difference between thier date in internal format and DataStage's.

NewDate = oconv(TheDate - 104314 + iconv("2004-11-09 ", "D-YMD[4,2,2]"), "D-YMD[4,2,2]")

Something like this should work.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You need to determine the base date on which your Julian dates are based. Typical base dates are 01/01/1900 and 01/01/1970. DataStage uses a base date of 31/12/1967, so you need to determine the offset between your base date and DataStage's; this becomes the constant in your calculation.

Code: Select all

Date          DataStage Internal Date
1900-01-01       -24835
1967-12-31            0
1970-01-01          732
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply