Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a date written as double format in the source database (for example 42286,6144737963). In the destination database I need to convert it to Date format yyyy-MM-dd HH:mm:ss. Can I do it in tMap? I tried TalendDate.parseDate("yyyy-MM-dd HH:mm:ss", String.valueOf(row10.StartDATE )) but it returns an error java.lang.NumberFormatException: For input string: "null".
Any help would be much appreciated
public static Date getDuration(Double timeInExcel) {
if (timeInExcel != null) {
int wholeDays = (int) Math.floor(timeInExcel);
int millisecondsInDay = (int) ((timeInExcel - wholeDays) * DAY_MILLISECONDS + 0.5);
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(0);
cal.set(Calendar.DAY_OF_YEAR, wholeDays + 1);
cal.set(Calendar.MILLISECOND, millisecondsInDay);
return cal.getTime();
} else {
return null;
}
}