Excel vs Unix Timestemp : excel datevalue to java dateformat Hint!

Unix Timestamp from 1970

Excel Timestamp from 1900

Gap : (1970-1900) Days = 25569 Days

 

 

String rtn = "";

try{

DateFormat format = new SimpleDateFormat("yyyyMMdd");

//format.setTimeZone(TimeZone.getTimeZone("UTC"));

double excelDays = Double.parseDouble((String)valv.elementAt(0));

double unixDays = (excelDays-25569);

java.util.Date unixTime = new java.util.Date((long) ( 86400000l * unixDays));

rtn = format.format(unixTime);

out.println(rtn);

} catch(Exception e) {}