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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -