dongmei2351 2016-04-07 09:05
浏览 43
已采纳

将字符串转换为正确的日期格式(joomla格式)[重复]

This question already has an answer here:

I got a barebone joomla version (so just pure php using the joomla cms and table names). And the published date of an article is saved like this:

2016-04-06 14:38:52

How can I convert that string into something like:

6 April 2016

So ignore the time and only use the date in the correct format.

How can this be done using PHP (no joomla build in functions)?

</div>
  • 写回答

3条回答 默认 最新

  • duai1683 2016-04-07 09:10
    关注

    You can do it with date and strtotime function of php

    $t="2016-04-06 14:38:52";
    echo date('j F Y', strtotime($t));
    

    F :- A full textual representation of a month, such as January or March

    j :- Day of the month without leading zeros

    Y :- A full numeric representation of a year, 4 digits

    OUTPUT

    6 April 2016

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

报告相同问题?

悬赏问题

  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?