php Object of class DateInterval could not be converted to string

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.

Leave a Comment