Jainul Khan
SENIOR EXECUTIVE MANAGER
Pages
Home
About Me
Events & Gallery
Contact
Monday, January 13, 2014
Converting Seconds Into HH:MM:SS Format Using SQL Server
DECLARE
@Seconds
INT
SET
@Seconds
=
90
SELECT
REPLACE
(
STR
(
@Seconds
/
3600
,
LEN
(
LTRIM
(
@Seconds
/
3600
))
+
ABS
(
SIGN
(
@Seconds
/
359999
)
-
1
))
+
':'
+
STR
((
@Seconds
/
60
)
%
60
,
2
)
+
':'
+
STR
(
@Seconds
%
60
,
2
),
' '
,
'0'
)
AS
TIME
Output: 00:01:30
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)