Using xsxl to import excel, it was found that there was something wrong with the date import, and it became a five-digit figure, for example, 43383 in 2018-10-10.

Baidu knows that it can be solved by adding a semicolon before the date, but how to convert it to a normal date in the JS code

Mar.21,2022

/**
 * @param excelTime
 * @returns {number}
 */
function excel_time_to_timestamp(excelTime) {
  const second = 25569,
    day_timestamp = 24 * 60 * 60 * 1000;
  return (+excelTime - second) * day_timestamp;
}

you can use this algorithm to convert excel time into the correct timestamp

Menu