troubleshooting Question

how to just get time from a date

Avatar of Chris Jones
Chris JonesFlag for United States of America asked on
Microsoft SQL ServerSQL.NET Programming
6 Comments1 Solution122 ViewsLast Modified:
hello

I am just trying to get a time from the query I have and its giving me the default date then my time. The time is the only part that I need in that field.

What i get
1900-01-01 00:00:55.000

what i need
00:00:55

my SQL
 select  datediff(hour, 0, cast(CallTime as time)),
  DATEADD(ms, SUM(DATEDIFF(ms, '00:00:00.000',  convert(varchar(10), dateadd(second, Duration, 0), 108))), '00:00:00.000') as time
  from NT_API_CallLogs
 WHERE Duration <> 0
 AND cast(CallTime as date) = '2017-3-08'
GROUP BY datediff(hour, 0, cast(CallTime as time) )
ORDER BY datediff(hour, 0, cast(CallTime as time) )
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros