calculating the number of days using strtotime returns wrong result

Vijit

New Member
I have two dates stored in a mysql database (Type = date). For example - Date 1 = 2010-09-20
Date 2 = 2010-10-20I want to calculate the number of days between these two dates. So have tried this - \[code\]$number_days = (strtotime($date2) - strtotime($date1) / (60 * 60 * 24));\[/code\]But this returns 49How so?------------------------------------- UPDATE ------------------------------------------Ok I realised my problem which was causing some confusion. I was using another function to retrieve date 1 and for various reasons this date was not being returned correctly so the number of days given was actually correct. When I retrieved the correct date from the database my calculation above worked, taking in to account the precedence of / over -thanks for your responses.
 
Back
Top