zoukankan      html  css  js  c++  java
  • 通过时间相差的分钟数,得出加班半小时,1小时,1.5不时,2小时等..

    ALTER  function   [dbo].[GetHour](@dt1 datetime,@dt2 datetime)
      returns  varchar(30)
      as    
      begin  
       declare   @ch   as   varchar(30)  
       declare   @mins as int   
       select @mins =(SELECT datediff( MINUTE, @dt1 , @dt2))   
        if   @mins>= 30 and @mins< 60   
           begin  
            set @ch = '0.5 H'
           end  
        else if  @mins>= 60 and @mins<90   
            begin  
            set @ch = '1 H'
           end
        else if @mins>= 90 and @mins<120    
            begin  
            set @ch = '1.5 H'
           end    
        else if @mins>= 120 and @mins<150    
            begin  
            set @ch = '2 H'
           end       
        else if @mins>= 150 and @mins<180    
            begin  
            set @ch = '2.5 H'
           end 
        else if @mins>= 180 and @mins<210    
            begin  
            set @ch = '3 H'
           end 
       else if @mins>= 210 and @mins<240    
            begin  
            set @ch = '3.5 H'
           end
       else if @mins>= 240 and @mins<270    
            begin  
            set @ch = '4 H'
           end
       else if @mins>= 270 and @mins<300    
            begin  
            set @ch = '4.5 H'
           end
       else if @mins>= 300 and @mins<330    
            begin  
            set @ch = '5 H'
           end 
      else     
            begin  
            set @ch = @mins
           end 
       return @ch
      end
     
     

  • 相关阅读:
    每日一题20201109(15. 三数之和)
    每日一题20201106(169. 多数元素)
    每日一题之20201103(941. 有效的山脉数组)
    每日一题之20201102(349. 两个数组的交集)
    【USACO4.4】追查坏牛奶
    【九省联考2018】一双木棋
    【NOI2013】向量内积
    【HNOI2013】游走
    【ZJOI2008】骑士
    【HEOI2014】大工程
  • 原文地址:https://www.cnblogs.com/szlixin/p/4335433.html
Copyright © 2011-2022 走看看