2015-07-21 158 views
-3

從網頁表格發佈了一個字符串:Jul 21 2015。它代表一個日期,但需要格式化。如何格式化爲2015-07-21如何將此字符串格式化爲日期格式?

+2

可能重複(http://stackoverflow.com/questions/2167916/convert-one-date-format-into- another-in-php) –

+4

您是否搜索過? –

回答

1

strtotime

$string = "Jul 21 2015"; 
$time = date("Y-m-j", strtotime($string)); 
[轉換一個日期格式轉換成另一種在PHP]