Created
December 14, 2012 15:27
-
-
Save nick-desteffen/4286260 to your computer and use it in GitHub Desktop.
Function to generate a random date between 2 dates
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
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