dsdtszi0520538 2014-04-13 23:01 采纳率: 100%
浏览 42
已采纳

将MySQL的日期时间更改为PHP中可读的文本

I am storing the time a player joins my server using a datetime datatype and inserting a CURRENT_TIMESTAMP. All this done in MySQL.

This will look something like this: 2014-04-14 02:15:03

However, on my website I want to display the time they join but on a more friendly way such as:

April 14, 2014 2:15CST

In a nutshell, how do I change "2014-04-14 02:15:03" into "April 14, 2014 2:15CST"?

Thanks!

  • 写回答

3条回答 默认 最新

  • doumanshan6314 2014-04-13 23:06
    关注

    Try to use it like the following:

    date('F d, Y H:i', strtotime($mysqlTimestamp));
    

    For more details, check the PHP date function at: http://php.net/manual/en/function.date.php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部