Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要将 now() 时间发布到 mysql(从 php 执行此操作)减去一秒(或分钟)。有没有办法做到这一点?
提前致谢!
select now() - interval 1 second
或使用DATESUB
select DATE_SUB(now(), INTERVAL 1 second)
SQLFiddle 示例
如果您需要格式化日期,您可以使用,
select TIME_FORMAT(now() - interval 1 second,'%H:%i:%s')
也有很多网站显示此信息。来源