CodeIgniter Forums

Full Version: how to get date duration?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]yudahebat[/eluser]
how to make function to get duration day from date1 to date2 on CI?
for example date1=2009-06-15 and date2=2009-07-05 so the duration day is 20 day

El Forum

[eluser]Thorpe Obazee[/eluser]
Code:
function datediff($a, $b)
{
   return date('j', strtotime($a) - strtotime($b));
}