在MySQL中,如何以用户指定的其他格式显示时间?
摘要:
以下示例将以指定格式更改当前时间-</p>mysql>SELECTDATE_FORMAT(NOW(),&#39;Thetimeis%h:%i:%s%p&#39;);+-----------------------------------------------+|DATE_FORMAT(NOW(),&#39;Thetimeis%h:...
以下示例将以指定格式更改当前时间 -< /p>
mysql> SELECT DATE_FORMAT(NOW(), 'The time is %h:%i:%s %p'); +-----------------------------------------------+ | DATE_FORMAT(NOW(), 'The time is %h:%i:%s %p') | +-----------------------------------------------+ | The time is 06:02:28 AM | +-----------------------------------------------+ 1 row in set (0.00 sec)
以下示例将以指定格式更改给定时间 -
mysql> SELECT DATE_FORMAT('2017-10-29 06:03:25', 'The time is %h:%i:%s %p'); +---------------------------------------------------------------+ | DATE_FORMAT('2017-10-29 06:03:25', 'The time is %h:%i:%s %p') | +---------------------------------------------------------------+ | The time is 06:03:25 AM | +---------------------------------------------------------------+ 1 row in set (0.00 sec)
以上就是在MySQL中,如何以用户指定的其他格式显示时间?的详细内容,更多请关注其它相关文章!