php - Convert string date to object date for database -
how convert date "20170101" date object doctrine date time accept database?
i have tried this;
$date = "20170101"; $date = strtotime($date); $newdate = date("y-m-d h:i:s", $date); $order->setdate($newdate);
but still error;
datetimetype ->converttodatabasevalue ('2017-01-01 00:00:00', object(postgresql92platform))
call member function format() on string
current dates in database same format
this should work
$date = \datetime::createfromformat('ymd', '20170101');
Comments
Post a Comment