We sometimes use php or mysql to generate many different user names, we found all users’ joining dates are the same. How to deal this issue then?
Let me share my skills with you.
<? function rand_time($a,$b) { $a=strtotime($a); $b=strtotime($b); return date( “Y-m-d H:m:s”, mt_rand($a,$b)); } $date1=”2012-02-20 08:15:42″; $date2=”2013-05-7 08:15:42″; $num = 2000; $i=0; while ($i < $num){ $date = rand_time($date1,$date2); $date=strtotime($date); $datea[]= $date; $i++; }
foreach ($datea as $values) { echo $values; echo “,<br>”;
} ?>