PHP DateInterval missing a period

2019-08-07 19:30发布

问题:

My aim is to generate a timestamp of every minute between two given dates (the actual problem is different, but this is similar in structure and simpler to describe). I'm using the following code:

    $Interval = DateInterval::createFromDateString('1 minute');
    $Period = new DatePeriod('2013-01-01', $Interval, '2014-01-01');

    foreach ($Period as $Dt){
       echo "Minute" . $Dt->format('i');
    }       

Problem is when I run this, I would expect to find 365*24*60 entries, or 525,600, but instead only 525,540 are returned. Interestingly, a whole 60 minute period is missing in March (13th March, 2-3am is missing).

This is really weird.. am I missing something completely obvious? Using PHP version 5.4.16

Cheers, Adrian