- 
      
- 
        Save BideoWego/1c67685ddb3bb55fdcebfa089f34f6f3 to your computer and use it in GitHub Desktop. 
    Random date in JavaScript
  
        
  
    
      This file contains hidden or 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 randomDate(start, end) { | |
| return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())); | |
| } | |
| console.log(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