Converting JD Edwards dates to standard dates

How-to(s), solutions to common problems, pearls of wisdom

kubosj
Posts: 372
Joined: Thu Jan 12, 2012 9:10 am

Converting JD Edwards dates to standard dates

Postby kubosj » Thu Apr 23, 2015 12:09 pm

Oracle's JD Edwards ERP system stores dates in a custom variant of a Julian date format as described at
https://docs.oracle.com/cd/E26228_01/do ... m#WEAWX259. While Clover does not have a built-in function to convert a JD Edwards date to a standard date , one can easily be written in CTL2.

Code: Select all

function date jdedate2date(decimal jdeDate) {

    string jdeString = num2str(decimal2integer(jdeDate));
    // calculate year component of date
    date standardDate = createDate(1900+((decimal2integer(jdeDate))/1000),1,1);
    // calculate day of year component of date
    integer days = str2integer(substring(jdeString, length(jdeString)-3))-1;
    // create standard date by adding days to year
    standardDate = dateAdd(standardDate, days, day);

    return standardDate;
}
Jaroslav Kubos
CloverCARE Support
CloverETL | Rapid Data Integration

Visit us online at http://www.cloveretl.com


cron