doushun9875 2013-02-25 20:09
浏览 17
已采纳

将日期转换为其他日期格式

All, I have a date format in the following output that I get from Tumblr:

2013-02-25 18:00:25 GMT

I'd like to convert this to a date format I want using the date function. I tried the following:

$date = date("F d, Y",$tumblr_posts->date); 
echo $date;

When I did this, the output was "January 01, 1970" which is obviously not right. Any ideas on how to fix this?

Thanks!

  • 写回答

1条回答 默认 最新

  • dongyi6269 2013-02-25 20:13
    关注

    You need to use the strtotime function like this.

    $date = date("F d, Y", strtotime($tumblr_posts->date));
    

    To find how to parse your date use the PHP date function reference.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失