Skip to content

Instantly share code, notes, and snippets.

@nick-desteffen
Created December 14, 2012 15:27
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save nick-desteffen/4286260 to your computer and use it in GitHub Desktop.
Save nick-desteffen/4286260 to your computer and use it in GitHub Desktop.
Function to generate a random date between 2 dates
start = new Date(2001, 0, 1)
end = new Date()
function randomDate(start, end) {
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()))
}
//http://apod.nasa.gov/apod/ap950616.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment