How to display a date as iso 8601 format with PHP

后端 未结 6 2096
遇见更好的自我
遇见更好的自我 2020-11-27 17:02

I\'m trying to display a datetime from my MySQL database as an iso 8601 formated string with PHP but it\'s coming out wrong.

17 Oct 2008 is coming out as: 1969-12-31

6条回答
  •  隐瞒了意图╮
    2020-11-27 17:16

    The second argument of date is a UNIX timestamp, not a database timestamp string.

    You need to convert your database timestamp with strtotime.

    
    

提交回复
热议问题