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

Mysql save article on the 31 of December at 14:25 but data function showing the date in 2019

Mysql 将文章保存为:2018-12-31 14:25:37。但网站上的日期是这样的:2019 年 12 月 31 日,2:25 下午。这是我的代码。

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

数据显示正确的年份。

ofor 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)

你应该使用 Y:

date("d F Y, g:i a", strtotime("2018-12-31 14:25:37"))
// 31 December 2018, 2:25 pm