Skip to content

Instantly share code, notes, and snippets.

@lac5
Created June 25, 2019 13:35
Show Gist options
  • Save lac5/2d0355be5a134af3e3ac306099d0da5a to your computer and use it in GitHub Desktop.
Save lac5/2d0355be5a134af3e3ac306099d0da5a to your computer and use it in GitHub Desktop.
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