datetime diff doesn't work

Posted by Ahmet vardar on Stack Overflow See other posts from Stack Overflow or by Ahmet vardar
Published on 2010-06-12T14:32:53Z Indexed on 2010/06/12 14:42 UTC
Read the original article Hit count: 136

Filed under:

Hi

here is my code

    function check($dt) {
    $date = date("Y-m-d");
    $start = new DateTime($date);
    $end   = new DateTime($dt);
    $diff  = $start->diff( $end );

    return $diff->format( '%d days' );
    }

print check('2009-12-14');

that prints 29 days

where am i wrong ?

© Stack Overflow or respective owner

Related posts about php