Php 如何使用twitter json结果将时间更改为仅天/月?

Php 如何使用twitter json结果将时间更改为仅天/月?,php,json,twitter,Php,Json,Twitter,我在尝试使用PHP访问我的twitter提要时得到了以下结果: Sat Apr 07 07:29:11 +0000 2012 我怎样才能把它改成4月7日 我使用的代码: $tweets = getTweets("http://twitter.com/status/user_timeline/justinbieber.json?count=3"); foreach($tweets as $tweet) { $time = $tweet->created

我在尝试使用PHP访问我的twitter提要时得到了以下结果:

Sat Apr 07 07:29:11 +0000 2012 
我怎样才能把它改成4月7日

我使用的代码:

   $tweets = getTweets("http://twitter.com/status/user_timeline/justinbieber.json?count=3");
      foreach($tweets as $tweet) {

        $time = $tweet->created_at;


}
用于将其转换为时间戳,然后使用或日期对其进行格式化

因此,在你的情况下:

$time = strftime('%h %d', strtotime($tweet->created_at));

然而,调用包含月和日时间的变量是一个非常糟糕的主意。毕竟是约会。

对不起。。。我不知道如何才能更详细地描述这一点。那么,有没有更好的方法来实现这一点?没有,strotime是将时间字符串转换为时间戳的最佳方法。只是不要调用存储格式化日期$time的变量,例如$date;
$time = strftime('%h %d', strtotime($tweet->created_at));