I have 2 dates and want to know how many the amount of days that come between them.
Lets say these two are the dates
2015-11-16 10:01:13
Following my comment, I thought I would post some examples from the PHP.net manual:
OOP style:
diff($datetime2);
echo $interval->format('%R%a days');
?>
Procedural style:
format('%R%a days');
?>
Both examples will output:
+2 days
You can also compare word strings as such (when using OOP style, this is an example from PHP.net):
$date2);
?>
Producing:
bool(false)
bool(true)
bool(false)
Using your dates:
OOP
diff($datetime2);
echo $interval->format('%R%a days');
?>
Procedural
format('%R%a days');
?>
Result from both:
-194 days
I sincerely hope this helps :)