How to identify unknown date time format which is five digits followed by twelve digits, and deal with in NodeJs

Viewed 33

Checked several other Stack Overflow Questions, searched for a while through all unknown date format questions, none I found look like this. I need to deal with this type of date time format in Javascript, which Google Sheets and LibreOffice Calc both are able to recognize and parse as 5/24/2023 10:00 for this example.

45070.416666666664 <- what date time format is this?

1 Answers

In GSheets (as others), change format to date.

In app script, use

function myFunction() {
  const sh = SpreadsheetApp.getActiveSheet()
  const value = sh.getRange('C1').getValue()
  console.log (Utilities.formatDate(value, Session.getScriptTimeZone(), "MM/dd/yyyy HH:mm"))
}
Related