Hi Folks, I'm busy in making an article directory - article.b2bplanet.net. I need your help again. Please give me the piece of PHP code to generate a random time (Format - YYYY-MM-DD HH:MM:SS) within a given period of time. Suppose a random time within the range 2011-01-01 00:00:00 to 2011-05-01 12:34:00, i.e. I can define a max and min range of the random time just like mt_rand() function.
This thread can be set closed. I've done it myself and happy to share it: function rand_time($max, $min){ return date("Y-m-d H:i:s", mt_rand(strtotime($min),strtotime($max))); } PHP: