急,请问如何判断两个时间段的差是否小于30分钟,入8:20和10:00

解决方案 »

  1.   

    if strtotime('10:00')-Strtotime('8:20')<30
      

  2.   

    在SQL 中可以使用
    datediff(minute,开始时间,结束时间)<30 
    如果是在DEPHI 中,可以用 时间相减 1 表示一天,可以算出来30分钟是多少
    1/(24*60) 
    就可以了。
      

  3.   

    Unit
    DateUtilsfunction MinutesBetween(const ANow, AThen: TDateTime): Int64;uses
       DateUtils;if minutesbetween(now,then)<=30 then 
    showmessage('<30');
      

  4.   

    最苯的办法,
    用decodetime将时间分解,然后用小时*60+分钟,看是否>30就可以了
    好象时间直接相减也可以,我试试再告诉你
      

  5.   

    if time1-time2<(30/(24*60)) then 
      

  6.   

    var hourX, minuteX, hourY, minuteY : integer;
    begin
      ...
      //给时间赋值。
      if ((hourY*60+minuteY)-(hourX*60+minuteX))<30 then
      begin
        ...
        //处理代码
      end
    end;
      

  7.   

    既可以通过直接相减,也可以通过现有的函数 if WithinPastMinutes(const ANow, AThen: TDateTime; 30)then或者if (ANow-AThen) <30/60/24 then