Skip to content

Instantly share code, notes, and snippets.

@Lugghawk
Last active April 24, 2017 14:12
Show Gist options
  • Save Lugghawk/02800f5d2e8733395011bfaf982aa5e8 to your computer and use it in GitHub Desktop.
Save Lugghawk/02800f5d2e8733395011bfaf982aa5e8 to your computer and use it in GitHub Desktop.
//From here: http://stackoverflow.com/questions/9035627/elegant-method-to-generate-array-of-random-dates-within-two-dates
function randomDate(start, end) {
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
}
//Create a new date between Jan 1st, 2012 and Now.
randomDate(new Date(2012, 0, 1), new Date())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment