我會嘗試格式化日期時間,例如Thu Jun 15 2017 14:12:28 GMT 0700 (SE Asia Standard Time)
,其格式類似於PHP中的2017-06-5
。我用date_create
但有errorl這樣如何在php中格式化日期時間
Warning: date_format() expects parameter 1 to be DateTimeInterface, string given
,這我PHP代碼從$ 22
$aa = date_format($w22,"Y-m-d");
echo $aa;
含量Thu Jun 15 2017 14:12:28 GMT 0700 (SE Asia Standard Time)
如何格式化日期時間像我,請幫我解決我的問題。由於
我認爲這是因爲'GMT 0700(東南亞標準時間)'。這不是一個日期,這就是爲什麼'date_create()'什麼都不返回。嘗試回聲'$ w22' – Swellar
我認爲[createfromformat](http://php.net/manual/en/datetime.createfromformat.php)可能有一些幫助? – Naruto
試試這個日期('Y-m-d',strtotime($ date)); –