I had a case where I had to import data from an xlsx document with a bunch of columns. One of the columns was formatted as datetime and posed a problem because after the date was read, that particular column was transformed into a double ddddd.tttttt.
After reading this article a understood how to parse the serial datetime that was being returned. And because I didn’t find anything on the net I decided to share the code I created and used:
var dt = new Date("1/1/1900"); // set the hour / minute / second var h = workbook.data[i][j].toFixed(5)%1*24; var m = h.toFixed(2)%1*60; var s = m.toFixed(2)%1*60; dt.setDate((dt.getDate() + workbook.data[i][j])-2) dt.setHours(h.toFixed(0)); dt.setMinutes(m.toFixed(0)); dt.setSeconds(s.toFixed(0));
Hope someone finds this useful