Displaying strtotime() effectively in MySQL/PHP query

前端 未结 4 629
我寻月下人不归
我寻月下人不归 2021-01-23 11:09

This is my PHP/MySQL query, as mentioned at Displaying links in PHP/MySQL?:

http://pastebin.com/5Td9Bybn

I\'ll admit, I\'ve forgotten how to use the strtotime()

4条回答
  •  别那么骄傲
    2021-01-23 11:48

    You can do it directly in MySQL, which saves you the overhead of strtotime()'s parseing overhead, and guaranteed to produce the right results, as strtotime can guess wrong occasionally.

    SELECT DATE_FORMAT(yourdatefield, '%h:%i') ...
    

提交回复
热议问题