时间包括时分秒,它们时率是

1个回答

  • declare @day int

    declare @hour int

    declare @min int

    declare @sec int

    declare @alls int

    set @alls=datediff(s,'2009-11-21 00:00:00','2009-11-24 15:12:24')

    set @day=@alls/86400

    set @hour=(@alls-@day*86400)/3600

    set @min=(@alls-@day*86400-@hour*3600)/60

    set @sec=@alls-@day*86400-@hour*3600-@min*60

    select CAST(@day as varchar(5))+'天'+CAST(@hour as varchar(2))+'小时'+CAST(@min as varchar(2))+'分'+CAST(@sec as varchar(2))+'秒'