Friday 12 June 2015

date difference in php

$d1 = new DateTime("2009-07-01");
$d2 = new DateTime("2010-05-31");
var_dump($d1->diff($d2)->m + ($d1->diff($d2)->y*12));

No comments:

Post a Comment