Page 1 of 1

Julian Date to YYYYMMDD

Posted: Tue Nov 23, 2004 2:54 pm
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

Posted: Tue Nov 23, 2004 3:40 pm
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.

Posted: Tue Nov 23, 2004 5:57 pm
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.

Posted: Tue Nov 23, 2004 8:44 pm
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