Advertisement
WorkAkkaunt

FUNCTION get time from seconds

Aug 7th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.63 KB | None | 0 0
  1. USE [oktell]
  2. GO
  3. /****** Object:  UserDefinedFunction [dbo].[GetTimeFromSecond]    Script Date: 07.08.2019 9:32:01 ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8.  
  9. -- =============================================
  10. -- Author:      <Author,,Name>
  11. -- Create date: <Create Date, ,>
  12. -- Description: <Description, ,>
  13. -- =============================================
  14. ALTER FUNCTION [dbo].[GetTimeFromSecond] (@sec int)
  15. RETURNS varchar(10) AS  
  16. BEGIN
  17.   return CONVERT(varchar(6), @sec/3600)+ ':' +
  18.     RIGHT('0' + CONVERT(varchar(2), (@sec % 3600) / 60), 2) + ':' +
  19.     RIGHT('0' + CONVERT(varchar(2), @Sec % 60), 2)
  20.  
  21. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement