This is a quick and DIRTY way to calculate the local date-time for a UTC date-time value (SQL-Server doesn’t seem to have an in-built method to calculate this).
DATEADD(hh,DATEDIFF(hh,GETUTCDATE(), GETDATE()),<TimeValue>)
Important: this should not be used in production as it does not take into account day light savings time and what should be done if the timeValue is from a DST date and the current datetime is not in DST.
No comments:
Post a Comment