<?php
$d1=date_create('2009-12-25');
$i=DateInterval::createFromDateString('-1 year');
$p=new DatePeriod($d1,$i,5);
foreach($p as $d) {
echo $d->format('Y-m-d') . "\n";
}
- Output for 5.6.0 - 5.6.30, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.5 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- 2009-12-25
2008-12-25
2007-12-25
2006-12-25
2005-12-25
2004-12-25
preferences:
154.34 ms | 408 KiB | 5 Q