Skip to content

DateInterval d property is 0 instead of real value 28 #18183

Closed as not planned
Closed as not planned
@bdtarcsa

Description

@bdtarcsa

Description

The following code:

<?php
$md_1st = new DateTime("2025-03-01");
  $md_last = new DateTime("2025-03-29");
  $mn_interval = $md_1st->diff($md_last);
echo $mn_interval->days . "  " . $mn_interval->d;

Resulted in this output:

28 0

But I expected this output instead:

28 28

PHP Version

Correction
not PHP 8.3.19 PHP 8.0.30 or 7.4.33

Operating System

linux (kernel ver.: 4.18.0-553.33.1.el8_10.x86_64)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions