PHP strtotime对于日期和星期几不起作用


PHP strtotime not working for date and day of week

这里有一个奇数。。。很确定这是一个暂时的问题,但我希望得到一些帮助,说明为什么这会部分起作用。。。

代码:

$dateReturnedFromMySQL = '2014-09-22 18:00:00'
$startDate = strtotime( $dateReturnedFromMySQL );
$startMonth = date( 'M', $startDate );
$startDate = date( 'd', $startDate );
$startDay = date( 'D', $startDate );
$startFullDate = date('M d, Y', $startDate );

变量$startMonth、$startDate输出正确。(分别为9月22日)

变量$startFullDate返回1969年12月31日(显然是一个strtotime问题,但不确定为什么?)

变量$startDay总是返回为Wed(同样,这显然是一个strtotime问题,但不确定为什么?)

您正在覆盖原始变量:

$startDate = date( 'd', $startDate );
^^^^^^^^^^ here

你应该用一个不同的名字。