You need to call DateInterval::format()
to display that difference as a string.
echo $diff->format('%d days');
See the manual for all of the available formatting options.
More Related Contents:
- How we can add two date intervals in PHP
- Get a PHP DateTime difference in days, considering midnight as a day change
- Are PHP DateInterval comparable like DateTime?
- PHP DateTime supported formats
- How do I compare two DateTime objects in PHP 5.2.8?
- Calculate number of hours between 2 dates in PHP
- Correctly determine if date string is a valid date in that format
- How to calculate the difference between two dates using PHP?
- Adding one day to a date
- Add ‘x’ number of hours to date
- How to find day of week in php in a specific timezone
- Simplest way to increment a date in PHP?
- Get interval seconds between two datetime in PHP?
- Check whether the string is a unix timestamp
- How to store NULL values in datetime fields in MySQL?
- NOW() function in PHP
- How to convert ISO8601 to Date format in php
- How to compare two time in PHP
- python format datetime with “st”, “nd”, “rd”, “th” (english ordinal suffix) like PHP’s “S”
- PHP: strtotime is returning false for a future date?
- How do I find the hour difference between two dates in PHP?
- How do I convert datetime to ISO 8601 in PHP
- How do you explain the result for a new \DateTime(‘0000-00-00 00:00:00’)?
- Get Start and End Days for a Given Week in PHP
- PHP Fatal error: Call to a member function format() on boolean
- adding 1 day to a DATETIME format value
- adding two time values of similar formats using php
- Subtracting a certain number of hours, days, months or years from date
- Getting first weekday in a month with strtotime
- How do I convert an ISO8601 date to another format in PHP?