我正在使用插件来创建twitter feed中的wordpress帖子,并且我正在尝试对其进行编辑,以便发布的时间与推文时间相同,而不是cron的运行时间。发布日期date_create_from_format()
不幸的是,twitter的API返回一个已经格式化的日期字符串,而不是时间戳,所以我不得不解析它,然后以wordpress友好的格式保存它。
// Wed Jun 06 20:07:10 +0000 2012 (Twitter formatted date example)
// 2014-03-10 18:30:26 (Wordpress formatted date example)
$tweet_date = $tweet->created_at;
$tweet_date = date_create_from_format("D M d h:i:s O Y", $tweet_date);
$tweet_date = date("Y-m-d h:i:s", $tweet_date);
不幸的是,我从这个Unix Epoch(1970年1月1日)得到的结果。
我知道我必须错过一个步骤,但我不知道在哪里。
我没有注意到这一点。 +1超快速和演示。 –
完美。由于早期的回应,我已经接近工作了,但仍然挂在我不正确的'h'上。谢谢! – Brownski