我正在使用Laravel和bootstrap日期时间选择器 选择器给我回复了这样的刺痛
" 16/12/2017 16:53 PM"
我想以日期时间格式将其存储在数据库中
答案 0 :(得分:2)
试试这个:
-LINK_FILE cannot be resolved or is not a field
或者,如果您有特定格式:
$dateTime = new Carbon\Carbon('2017-01-23 3:45pm');
答案 1 :(得分:0)
你最好在你的js中寻找格式,所以它只是一个约会时间。
说过这会有效:
//date
$date = "16/12/2017 16:53 PM";
//replace / with -
$date = str_replace('/','-',$date);
//remove PM and AM
$date = str_replace('PM','',$date);
$date = str_replace('AM','',$date);
//create a new instance of DateTime and pass in the date
$date = new \DateTime($date);
//print date format
echo $date->format('Y-m-d H:i:s');