Convert specific time format to in PHP to MYSQL datetime type
I need some help about time formatting.
The input I get from a file is (for example): Wed Jun 28 19:12:55 CEST 2015, so: name of the day Month(text) Day Hour:minute:second Timezone Year.
I would like to convert it to Mysql datetime format, to be able to store in a database.
The format is (for example): 2016-03-06 12:09:44, which is Year-Month (number)-Day Hour-Minute-Second
Thank you!
You can use date function of php.
echo date("Y-m-d h:i:s",strtotime($yourDateTimeVariable));
for more help see php manual for date.
http://php.net/manual/en/function.date.php
Hope it helps
链接地址: http://www.djcxy.com/p/58984.html