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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -