我正在尝试在 php 中转换日期,但没有成功。任何帮助都会非常显着。
我的代码:
$playing_dates='06/03/2013|13/03/2013|20/03/2013|27/03/2013|03/04/2013|10/04/2013|17/04/2013|24/04/2013|01/05/2013|08/05/2013|15/05/2013|22/05/2013|29/05/2013';
$playing_dates = explode("|", $playing_dates);
for($i=0; $i<count($playing_dates);$i++){
$playing = strtotime($playing_dates[$i]);
echo $playing_dates[$i]." --> ".$playing." -->";
echo date('D, j M Y H:i:s', $playing)."</br>";
}
实际输出:
06/03/2013 --> 1370214000 -->Mon, 3 Jun 2013 00:00:00
13/03/2013 --> -->Thu, 1 Jan 1970 01:00:00
20/03/2013 --> -->Thu, 1 Jan 1970 01:00:00
27/03/2013 --> -->Thu, 1 Jan 1970 01:00:00
03/04/2013 --> 1362355200 -->Mon, 4 Mar 2013 00:00:00
10/04/2013 --> 1380841200 -->Fri, 4 Oct 2013 00:00:00
17/04/2013 --> -->Thu, 1 Jan 1970 01:00:00
24/04/2013 --> -->Thu, 1 Jan 1970 01:00:00
01/05/2013 --> 1357344000 -->Sat, 5 Jan 2013 00:00:00
08/05/2013 --> 1375657200 -->Mon, 5 Aug 2013 00:00:00
15/05/2013 --> -->Thu, 1 Jan 1970 01:00:00
22/05/2013 --> -->Thu, 1 Jan 1970 01:00:00
29/05/2013 --> -->Thu, 1 Jan 1970 01:00:00
预期输出:
06/03/2013 --> 1370214000 -->Wed, 6 Mar 2013 00:00:00
13/03/2013 --> -->Wed, 13 Mar 2013 00:00:00
20/03/2013 --> -->Wed, 20 Mar 2013 00:00:00
27/03/2013 --> -->Wed, 27 Mar 2013 00:00:00
03/04/2013 --> 1362355200 -->Wed, 3 April 2013 00:00:00
10/04/2013 --> 1380841200 -->Wed, 10 April 2013 00:00:00
17/04/2013 --> -->Wed, 17 April 2013 00:00:00
24/04/2013 --> -->Wed, 24 April 2013 00:00:00
01/05/2013 --> 1357344000 -->Wed, 1 May 2013 00:00:00
08/05/2013 --> 1375657200 -->Wed, 8 May 2013 00:00:00
15/05/2013 --> -->Wed, 15 May 2013 00:00:00
22/05/2013 --> -->Wed, 22 May 2013 00:00:00
29/05/2013 --> -->Wed, 29 May 2013 00:00:00