Skip to content

Instantly share code, notes, and snippets.

@arjenblokzijl
Created May 18, 2016 13:35
Show Gist options
  • Save arjenblokzijl/c042c776e47b42237d26370d44e76b05 to your computer and use it in GitHub Desktop.
Save arjenblokzijl/c042c776e47b42237d26370d44e76b05 to your computer and use it in GitHub Desktop.
Create random dates between in PHP
<?php
// Forgot where this came from
function rand_date($min_date, $max_date) {
$min_epoch = strtotime($min_date);
$max_epoch = strtotime($max_date);
$rand_epoch = rand($min_epoch, $max_epoch);
return date('Y-m-d H:i:s', $rand_epoch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment