I have two date fields in my form - $startdate and $enddate.
the dates are entered in format MM-DD-YYYY
I need to calculate the number of days between the two dates but with a slight twist.
Normally number of days could be calculated using :
Code: Select all
$timediff = (strtotime($startdate) - strtotime($enddate))/(60 * 60 * 24);1) the actual number of days for the start month
+
2) 30 days for all in-between months - even where months in the period may have 28, 29 or 31 days
+
3) Actual number of days for the end month.
For example:
If startdate = 7 Dec 2012
and enddate = 18 Aug 2013
i will take 24 days in dec
+
30*7 for inbetween 7 months (January 2013 to July 2013)
+
17 days in aug
How can i do this ?
Thanks for answering