Strange Result of Datetime::diff

[email protected]
Newsgroups php.general
Message-ID <[email protected]>
Hi, 

I'd expect the following script: 

<?php

$date1 = new DateTime('2017-03-01');
$date2 = new DateTime('2017-04-02');

$diff = $date1->diff($date2);

echo "{$diff->m} months and {$diff->d} days.";
?>

would print "1 months and 0 days.". But instead it prints "1 months and 3 days." (see https://3v4l.org/RMuUZ).
What is the reason for this behaviour?

Thanks in advance and best regards
Christian
-------------------------------------------------------------------------------------------------
FreeMail powered by mail.de - MEHR SICHERHEIT, SERIOSITÄT UND KOMFORT
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.