Fatal error: Call to a member function format() on a non-object for date in php -


i tried using code this

$checkin=isset($_post['check_in']);  $date1=date('y-m-d', strtotime($checkin)); 

while using above code i'm getting date 1970-01-01

now want date 2015-05-08

the date returned user through datepicker.

when doing - $checkin=isset($_post['check_in']);, $checkin have boolean value. strtotime() expect valid datetime. checks should added that. should -

if (isset($_post['check_in'])) {     $date1=date('y-m-d', strtotime($_post['check_in'])); } 

Comments