火车23:56到站
00:02开车
离开车30分钟时将它搜出来 
而且当前时间超过00:02时不搜它
应该怎么写呢?

解决方案 »

  1.   

    select * from train_schedule 
    where sysdate between start_date-30/24*60 and end_date
      

  2.   

    时间如果是'23:56'这样的字串,就这样改一下:select * from train_schedule 
    where to_date( to_char(sysdate,'HH24:MI'),'HH24:MI')
          between 
          to_date(start_date, 'HH24:MI')-30/24*60 
          and to_date(end_date, 'HH24:MI')
      

  3.   

    把时间格式转换成long型(自国际标准时间公元1970年1月1日00:00:00以来经过的秒数)
    这样,你想怎么写就怎么写,查找方便多了