Skip to content

Instantly share code, notes, and snippets.

@ahallora
Last active April 5, 2020 19:01
Show Gist options
  • Save ahallora/730a0fc574591e8199c3bf6aee86d766 to your computer and use it in GitHub Desktop.
Save ahallora/730a0fc574591e8199c3bf6aee86d766 to your computer and use it in GitHub Desktop.
Epoch / Unix timestamp to Excel Date converter in JavaScript / ES6 / Node
const timestampToExcelDate = timestamp => {
const start = new Date("1899-12-30 00:00:00");
return (timestamp - start) / (1000 * 60 * 60 * 24).toFixed(12);
};
@ahallora
Copy link
Author

ahallora commented Apr 5, 2020

To convert timestamp to excel date (in Excel) here's the formula:

=(A1/86400000)+25569

Explanation:

=(A1/86400000)+DATE(1970;1;1)
=(1585900450502/86400)+25569
=43924,32929

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment