php 随机显示据今天30天内的任意一天

时间:2014-08-12 18:07:04   收藏:0   阅读:178
function randomDate() { 

    //echo date( "Y-m-d H:m:s", $newtime);
    //echo date("Y-m-d H:m:s", strtotime("+2 week 1 days 7 hours 5 seconds"));
    $begin = strtotime("now");  
    $end = strtotime("+1 Month");
    $timestamp = rand($begin, $end);  
    return date("Y-m-d H:i:s", $timestamp);
}
echo randomDate();

 

php 随机显示据今天30天内的任意一天,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!