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

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -