php - Find days in a certain date -
hi i'm trying echo days in "31-10-15" isn't working.
$inpdate = "31-10-2015"; echo "inpdate " . $inpdate . "<br>"; $inpdate1 = strtotime($inpdate); $inpdate1 = date('d-m-y',$inpdate1); echo "inpdate1 " . $inpdate1 . "<br>"; $days = date('d', $inpdate1); echo "days " . $days . "<br>";
$inpdate1
not valid string format date
, change line:
$days = date('d', $inpdate1);
to:
$days = date('d', strtotime($inpdate1));
Comments
Post a Comment