Wordpress IXR_Date错误的日期

时间:2012-08-19 14:44:47

标签: php wordpress strtotime

这是我的PHP代码:

echo date('m/d/Y h:i:s A T'),"<br>";
$match_date = strtotime(date('m/d/Y h:i:s A T'));
echo "match_date= ", $match_date, "<br>";

$test = new IXR_Date($match_date);
print_r($test);

但是返回错误的月和日值:

08/19/2012 07:38:10 AM PDT
match_date= 1345387090
IXR_Date Object ( [year] => 2012 [month] => 2012 [day] => 2012 [hour] => 07 [minute] => 38 [second] => 10 ) 

什么错了?如何正确使用IXR_Date?

1 个答案:

答案 0 :(得分:1)

使用time()功能代替strtotime而不是date

$test = new IXR_Date(time());