php - Convert ordered string to mysql Datetime -
i have api returns date string : 190416102906
which means : 19 april 2016 @ 10:29:06
.
i want store in mysql datetime don't know how format it. need go 190416102906
2016-04-19 10:29:06
.
i've tried use didn't understand how works :
$date_reponse = '190416102906'; $date = datetime::createfromformat("dmyhis",$date_reponse); $newdate = date_format($date, 'y-m-d h:i:s');
because format incorrect : "dmyhis"
y
= year format 4 digit.
use y
year 2 digit (dmyhis
)
$date = datetime::createfromformat("dmyhis",$date_reponse);
Comments
Post a Comment