One Star

Converting Juilan Date To Datetime

Hi All,
I want to convert the julian date of format YYYDDD into YYYYMMDD.
My source file is EBCDIC so that column containing julian date is cuming as Packed value with data type BigDecimal.
So Please guide me how to convert this date to format YYYYMMDD
One Star

Re: Converting Juilan Date To Datetime

You might create a custom routine in TOS.
 public static java.util.Date juLianToDate(int date) {  
int year = (date / 1000) + 1900;
int dayOfYear = date % 1000;
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.DAY_OF_YEAR, dayOfYear);
return calendar.getTime();

Hope this help you.