troubleshooting Question

SQL query from a table which stores data in UTC to collect UTC times that match local times.

Avatar of Bill Park
Bill ParkFlag for United States of America asked on
SQL* Microsoft SQL Server 2019
2 Comments1 Solution18 ViewsLast Modified:
I have a table that looks like this:
Device               Loc   CaptureTime
000000000005   17   11:26:16
000000000005   17   11:26:17
000000000005   17   11:26:18
000000000005   17   11:26:19
000000000005   17   11:26:20
000000000005   17   11:26:21
000000000005   17   11:26:22
000000000005   17   11:26:23
000000000004   17   11:26:23
000000000005   17   11:26:24
000000000005   17   11:26:25

The CaptureTime is stored as time(0) in UTC and has records for a 24 hour span that gets used for each successive day.

Think of the task as showing two digital clocks next to each other, one showing Pacific Time and the other showing UTC (Zulu) Time.
The local clock will be driven by GETDATE(), the other, the appropriate offset.
I need to put logic in a stored procedure that will query records that show the UTC equivalent of my local time, along with the other stuff in the record
I need it to be aware of and accommodate Daylight Savings Time.
This is in SQL Server 2019 so it will have whatever the most recent functionalities are.

Thank you. 
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
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 2 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