how to generate a date between 1998 and today by random?
| From: | andy | Date: | Tue, 07 May 2002 13:12:18 +0000 |
| Subject: | how to generate a date between 1998 and today by random? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-96409@lists.php.net to get a copy of this message | ||
hi there,
I am wondering if there is an easy way to generate a random date. It would
work by creating arrays of values and then just selecting like:
$year = array(2002, 2003, 2004, 2005);
$month = array
('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Okt','Nov','Dez');
$date = $month[rand(0,count($month))].' '.rand(0,31).',
'.$year[rand(0,count($year))];
But there might be an easyer and faster (better performant) way.
Thanx for any help,
Andy