Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 get only hh:mm:ss

Author  Topic 

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2011-04-13 : 05:49:51
hello everybody,
how do i get only hh:mm:ss from the time '14:50:25.3310000'.
i.e i need only '14:50:25'.
thanx in advance

Ranjit.ileni
Posting Yak Master

183 Posts

Posted - 2011-04-13 : 06:48:48
Check it once
SELECT CONVERT(VARCHAR(8),GETDATE(),108) AS HourMinuteSecond -- 16:17:40

SELECT CONVERT(VARCHAR(8),'14:50:25.3310000',108) AS HourMinuteSecond -- 14:50:25

--Ranjit
Go to Top of Page

raghuveer125
Constraint Violating Yak Guru

285 Posts

Posted - 2011-04-13 : 06:48:55
SELECT substring ( '14:50:25.3310000',1,8)

Raghu' S
Go to Top of Page

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2011-04-13 : 08:19:56
quote:
Originally posted by Ranjit.ileni

Check it once
SELECT CONVERT(VARCHAR(8),GETDATE(),108) AS HourMinuteSecond -- 16:17:40

SELECT CONVERT(VARCHAR(8),'14:50:25.3310000',108) AS HourMinuteSecond -- 14:50:25

--Ranjit



Thank Raghu...that worked like a charm
Go to Top of Page
   

- Advertisement -