Guest User

Untitled

a guest
Feb 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. // Get a random date between $start_date and $end_date
  2. function randomDate($start_date, $end_date)
  3. {
  4. // Convert to timetamps
  5. $min = strtotime($start_date);
  6. $max = strtotime($end_date);
  7.  
  8. // Generate random number using above bounds
  9. $val = rand($min, $max);
  10.  
  11. // Convert back to desired date format
  12. return date('Y-m-d H:i:s', $val);
  13. }
Add Comment
Please, Sign In to add comment