天天看點

PHP随機輸出最近一個月任一時間

function randomDate() {
    $begin = strtotime("now");
    $end = strtotime("-1 Month");
    $timestamp = rand($begin, $end);
    return date("Y-m-d H:i:s", $timestamp);
}
echo randomDate();
           
php