douping1993 2019-01-01 13:10
浏览 228
已采纳

Mysql在12月31日14:25保存文章,但数据函数显示2019年的日期

Mysql save the article like that: 2018-12-31 14:25:37. But on the website the date is like that: 31 December 2019, 2:25 pm. Here is my code.

date("d F o, g:i a", strtotime($article->created_at))

The data show show right year.

  • 写回答

1条回答 默认 最新

  • dqdt45183 2019-01-01 13:15
    关注

    o is for ISO-8601 week-numbering year:

    This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0)

    You should use Y:

    date("d F Y, g:i a", strtotime("2018-12-31 14:25:37"))
    // 31 December 2018, 2:25 pm
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址
  • ¥15 elmos524.33 eeprom的读写问题
  • ¥15 用ADS设计一款的射频功率放大器
  • ¥15 怎么求交点连线的理论解?