Skip to content

Instantly share code, notes, and snippets.

@lmeyer
Created March 9, 2014 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmeyer/9451321 to your computer and use it in GitHub Desktop.
Save lmeyer/9451321 to your computer and use it in GitHub Desktop.
Generate random date between two dates
<?php
date('Y-m-d H:i:s' ,rand(strtotime('now'), strtotime('+ 20 days')));
date('Y-m-d H:i:s', strtotime( '-'.mt_rand(0,3888000).' seconds'));
date('Y-m-d', strtotime( '+'.mt_rand(0,30).' days'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment