MySQL比较时间(datetime)大小

获取时间返回的秒数:strtotime('2019-05-10 00:00:00')

遇到一个业务功能需要将当前时间与数据库中的会议开始、结束时间进行比较,记录一下,方便下次用。

用unix_timestamp函数,将字符型的时间,转成unix时间戳。

select meeting_id,meeting_name,start_time,end_time from meeting_data
where meeting_id REGEXP '[0-9]{4}0001'
and unix_timestamp(start_time) < unix_timestamp(NOW())
and unix_timestamp(end_time) > unix_timestamp(NOW());
------------------------------------------------------------------------------------------------

原文:https://blog.csdn.net/qq_27124771/article/details/81219550

原文地址:https://www.cnblogs.com/showcase/p/10843147.html