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
 Query UTC, result in Local time

Author  Topic 

nibbio
Starting Member

2 Posts

Posted - 2011-09-09 : 04:35:54
Hello
I have a table where "IntervalStartDateTime" is in UTC. I need to create a wiew showing "intervalDateTime" in local time, because i'm UTC+2.

Thanks in advance

Follow my query:

SELECT TOP (100) PERCENT VDNStatsId, IntervalType, IntervalStartDateTime, IntervalEndDateTime, SwitchId, VDNDeviceId, VDNName, CallsTotal,
CallsFlowOut, CallsAnswered, CallsAbandoned, CallsCompleted, CallsWaiting, CallsHolding, LongestWaitingSeconds, LongestIntervalWaitingSeconds,
TotalTalkSeconds, TotalWaitSeconds, TotalHoldSeconds, TotalAbandonedSeconds, ShiftNumber, ServiceLevel, ServiceLevelSeconds,
ServiceLevelChanged
FROM dbo.VDNStats
WHERE (VDNDeviceId IN (N'9807192', N'9807193', N'9807340'))
ORDER BY IntervalStartDateTime

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-09 : 07:55:34
just do like DATEADD(hh,DATEDIFF(hh,GETUTCDATE(),GETDATE()),IntervalStartDateTime) as LocalIntervalStartDateTime

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

nibbio
Starting Member

2 Posts

Posted - 2011-09-12 : 03:28:09
Works very fine

Thank you!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-12 : 04:10:56
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -