Collect the number of days between two dates

advertisements

Possible Duplicate:
How to find number of days between two dates using php

Collect the number of days between two dates, for example 02/11/2012 And between 02/12/2012

The result is the number of days = 1 day


try this

function dateDiff ($d1, $d2) {

  return round(abs(strtotime($d1)-strtotime($d2))/86400);

}

The function uses the PHP ABS() absolute value to always return a postive number as the number of days between the two dates.