You could ignore the time portion of the date string
$date1 = new DateTime(date('Y-m-d', strtotime("2013-08-07 13:00:00")));
$date2 = new DateTime(date('Y-m-d', strtotime("2013-08-08 12:00:00")));
echo $date1->diff($date2)->days; // 1
More Related Contents:
- Display which day it is? sunday or monday “php coding”? [closed]
- Php date() Date and time is stuck [closed]
- PHP 01/01/1970 Issues with Date Fields
- Correctly determine if date string is a valid date in that format
- Compare given date with today
- PHP DateTime::modify adding and subtracting months
- Adding one day to a date
- Add ‘x’ number of hours to date
- How we can add two date intervals in PHP
- The first day of the current month in php using date_modify as DateTime object
- How to list all months between two dates
- How can I check if the current date/time is past a set date/time?
- Find Month difference in php? [duplicate]
- Simplest way to increment a date in PHP?
- How to generate random date between two dates using php?
- PHP order array by date? [duplicate]
- Set timezone in PHP and MySQL
- PHP, Get tomorrows date from date
- Calculate total seconds in PHP DateInterval
- How to convert ISO8601 to Date format in php
- How do I find the hour difference between two dates in PHP?
- Date in a URL dd/mm/yyyy
- mysql – INSERT date range into date columns IF dates don’t overlap with existing ones
- How do you explain the result for a new \DateTime(‘0000-00-00 00:00:00’)?
- day of the week to day number (Monday = 1, Tuesday = 2)
- Converting to date in PHP from yyyymmdd format
- Subtracting a certain number of hours, days, months or years from date
- How do I convert an ISO8601 date to another format in PHP?
- Get date for monday and friday for the current week (PHP)
- Determine If Business Is Open/Closed Based On Business Hours