duanlidi1051 2019-08-05 05:23
浏览 443

如果添加的日期和当前日期之间的持续时间不大于或等于2小时,则获取数据

I am creating a booking management system. I got stuck in the booking cancellation part. I want to allow users to cancel their orders if their booking time and the current time duration is between 2 hours because I want to restrict the users to cancel their booking if their booking time and current time duration is greater than or equal to 2 hours.

I want to generate a query that returns all the bookings whose booking time is less than 2 hours. How can I achieve this?

This is my database structure. Image

  • 写回答

3条回答 默认 最新

  • dongwen5019 2019-08-05 05:37
    关注

    You can extract the hour part of your date. Refer to this link

    Then using this query to get those less than 2 hours.

    SELECT * FROM table1 WHERE tdate - 120 < EXTRACT(MINUTE FROM now()) 
    
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!