獲取時間返回的秒數: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