Format date in MySQL SELECT as ISO 8601

前端 未结 7 2129
攒了一身酷
攒了一身酷 2020-12-05 17:14

I\'m trying to grab the date from my database in a standard timestamp and display it as ISO 8601. I\'m unable to easily do it in PHP so I\'m trying to do it in my SELECT st

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-05 17:48

    Why is it hard to do it in PHP?

    date("Y-m-d\TH:i:sO",strtotime($sqldata['time']));
    

    Anyway, that DATE_FORMAT needs to be in the fields to select, not tacked on to the end.

提交回复
热议问题