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()) 
    
    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算