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
     
     

  • 相关阅读:
    递归方程(续)
    递推方程
    协方差简单介绍
    排列组合
    牛顿法
    jquery常用方法总结
    RegExp的test()方法
    localStorage用法总结
    正则表达式
    登录页面按回车键实现登陆效果
  • 原文地址:https://www.cnblogs.com/szlixin/p/4335433.html
Copyright © 2011-2022 走看看