[php][零散代码]php日期计算

[php][零散代码]php日期计算

 

<?php
$startData = "2020-01-1";
$stopData = "2020-01-31";
    $s = new \DateTime($startData);
    $e = new \DateTime($stopData);
    $days = $s->diff($e)->days;
for ($i=0;$i<=$days;$i++){
    echo date('Y-m-d',strtotime("+".$i." day",strtotime($startData)))."\r\n ";  
}

?>

 

posted @ 2020-04-24 17:45  landv  阅读(105)  评论(0编辑  收藏  举报