Created
June 25, 2019 13:35
-
-
Save lac5/2d0355be5a134af3e3ac306099d0da5a to your computer and use it in GitHub Desktop.
This file contains 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 julian(date) { | |
date = new Date(date); | |
let year = date.getFullYear(); | |
let days = Math.floor((date.valueOf() - new Date(year, 0, 0).valueOf()) / 86400000); | |
return `${year}${`000${days}`.slice(-3)}`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment