📜  foreach 日期 php 代码示例

📅  最后修改于: 2022-03-11 14:54:31.903000             🧑  作者: Mango

代码示例3
$begin = new DateTime('2010-05-01');
$end = new DateTime('2010-05-10');

$interval = DateInterval::createFromDateString('1 day');
$period = new DatePeriod($begin, $interval, $end);

foreach ($period as $dt) {
    echo $dt->format("l Y-m-d H:i:s\n");
}