Created
January 17, 2018 15:53
-
-
Save catdad/1193bcc3e4f6fc65142d431a8bfe910f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function excelDateToJsDate(excelDate) { | |
// this code was originally written in https://gist.github.com/christopherscott/2782634 | |
return new Date( | |
(excelDate - (25567 + 1)) * 86400 * 1000 | |
); | |
} | |
function jsDateToExcelDate(date) { | |
// just working backwards from the code above | |
return (date.getTime() / (86400 * 1000)) + (25567 + 1); | |
} | |
function isoStringToExcelDate(isoString) { | |
return jsDateToExcelDate(new Date(isoString)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment