Convert Julian Date into Date

Hi There,

Does anybody know a simple way to transform a julian date (104159 = cyyddd) into a date?

Thanks,
Natalie

That looks like the JDEdwards goofy date format. You can write a simple java service to convert it:

Input parameters:
JDEDate String
JDETime String
Output parameter:
DateOut Object java.util.Date

==============================

// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String strJDEDate = IDataUtil.getString( pipelineCursor, “JDEDate” );
String strJDETime = IDataUtil.getString( pipelineCursor, “JDETime” );
pipelineCursor.destroy();

boolean goodJDEDate = (strJDEDate != null);
boolean goodJDETime = (strJDETime != null);

int year=0;
int dayOfYear=0;
int hour=0;
int minute=0;
int second=0;

java.util.Date DateOut = new java.util.Date();

/* Convert JDE date to String: X + YY + DayOfYear
where X = 1 for 20xx dates, 0 for 19xx dates */

if (goodJDEDate)
{
try
{
year = new Integer(strJDEDate.substring(0,3)).intValue() + 1900;
dayOfYear = new Integer(strJDEDate.substring(3)).intValue();
}
catch (NumberFormatException e)
{
goodJDEDate = false;
}
}

if (goodJDEDate)
{
/* Initialize */
java.util.Calendar current_cal = java.util.Calendar.getInstance();

/* Set Calendar to Given Date */
current_cal.set(current_cal.YEAR, year);
current_cal.set(current_cal.DAY_OF_YEAR, dayOfYear);

if (goodJDETime)
{
if (strJDETime.length() != 6)
goodJDETime = false;
else
{
try
{
hour = new Integer(strJDETime.substring(0,2)).intValue();
minute = new Integer(strJDETime.substring(2,4)).intValue();
second = new Integer(strJDETime.substring(4,6)).intValue();
}
catch (NumberFormatException e)
{
goodJDETime = false;
}
}
}
if (goodJDETime)
{
current_cal.set(current_cal.HOUR_OF_DAY, hour);
current_cal.set(current_cal.MINUTE, minute);
current_cal.set(current_cal.SECOND, second);
}
else
{
current_cal.clear(current_cal.HOUR_OF_DAY);
current_cal.clear(current_cal.MINUTE);
current_cal.clear(current_cal.SECOND);
}

DateOut = current_cal.getTime();
}
// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
Object objDateOut = new Object();
if (goodJDEDate)
objDateOut = DateOut;
else
objDateOut = null;

IDataUtil.put( pipelineCursor_1, “DateOut”, objDateOut );
pipelineCursor_1.destroy();

Or, if you want to use flow, you can substring the date from 104159 to 04159 (yyddd) nd use the pub.date:dateTimeFormat service with the following inputs:

inString:04159
currentPattern: yyddd
newPattern: yyyyMMdd or whatever format you want.

Hi there,

Yes, you’re right about the JDEdwards date format.

Thank you both for your answers, they both work great.