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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM