我想使用php从mysql检查时间可用性,这是我的表
id employeeid booking_starttime bookingclosetime
1 4 1565347980 1565349300
1 4 1565360100 1565364900
现在我有动态booking_start_time(1565346900)
和booking_end_time(1565350500)
,并且我想检查是否存在booking_starttime(varchar)
和booking_endtime(varchar)
这段时间之间的数据库又该怎么办?
答案 0 :(得分:1)
看看您是否有两个时间戳,您可以像这样将它们简单地进行比较,因为它们只是数字。
Select * from table where booking_starttime < bookingclosetime
现在回答您的问题:
现在我有动态的booking_start_time(1565346900)和 booking_end_time(1565350500)我要检查是否 booking_starttime(varchar)和booking_endtime(varchar)存在于 在这段时间之间的数据库,那我该怎么办?
SELECT * FROM table where booking_start_time = '1565346900' AND booking_end_time = '1565350500'
答案 1 :(得分:0)
MySQL提供between关键字,它将为您执行这种操作
Select * from table where :date between start_date and end_date