0
我的php代碼顯示所有亂七八糟的日期。php strtotime函數沒有返回正確的日期
$d='2016-08-17T09:47:36Z';
echo(date(" d M, Y G:i:a", strtotime($d)));
//shows 17 Aug, 2016 5:47:am
爲什麼沒有顯示2016年8月17日09:47:我
我的php代碼顯示所有亂七八糟的日期。php strtotime函數沒有返回正確的日期
$d='2016-08-17T09:47:36Z';
echo(date(" d M, Y G:i:a", strtotime($d)));
//shows 17 Aug, 2016 5:47:am
爲什麼沒有顯示2016年8月17日09:47:我
這是由於不同的時區,你需要設置UTC
時區爲此,
date_default_timezone_set('UTC');
$d='2016-08-17T09:47:36Z';
echo(date(" d M, Y G:i:a", strtotime($d)));
參考date()欲瞭解更多信息和online demo。
嘿,謝謝你的工作,也解決了我的另一個問題:) –
它的工作:-https://eval.in/623748和https://eval.in/623749 –
打開到單獨的文件,並檢查它,因爲它在這裏工作得很好。 – Noman
@Anant,這是因爲eval.in使用UTC和ISO日期也使用UTC。 https://eval.in/623755 –