Possible Duplicate:
How to find number of days between two dates using php
I'm trying to compare two dates that are stored in two PHP variables. $curDate
and $prevDate
are stored in the format yyyy-mm-dd
. To simply display them, I've been using date("n,j,Y", strtotime($prevDate))
or some other combination of the first parameters of the date function.
I want to compare the $curDate
and $prevDate
on the scale of days, but the trouble is, the 31st could be 1 day from the 1st so if I just look at the date in this way then I can't handle that behavior.
I've looked into the PHP Function JulianToJD()
but can't just pass the SQL date, formatted thru the date()
and strtotime()
function.
Can someone help me figure out a clever way of comparing two dates on the scale of days while paying attention to the end of months?