0

I used

DATEADD(mi, DATEDIFF(mi, GETUTCDATE(), GETDATE()), m.StartDateTime) 

to get the local datetime from the original m.StartDateTime column in SQL Server 2017 database, and it works fine for me.

However, when using this in an Azure SQL Managed Instance, the local datetime is still the same as attached screenshot.

StartRunningDateTime_AzureMI_DateTime = StartRunningDateTime_Local_DateTime

I have added the column StartRunningDateTime_Expected_DateTime that 13 hours are added to get correct local datetime. However, my country uses daylight saving, so it will plus 12 hours in others months.

Please help me out how to use DATEADD and GETUTCDATE correctly to achieve the goal.

Thank you in advance.

enter image description here

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

0 Answers0