MS CRM How to convert UTC to local date with daylights savings
Before you connect to CRM Database, you need to make sure the user which you are using to login to SQL management Studio has permissions and the entities and also the personal profile of the user in CRM has the current local date and timezone
In order to change the personal profile timezone, login to CRM and click on settings to customize your time zone:
Now when you connect to CRM SQL Database with the user, your personal profile already have a timezone different from UTC (potentially)
Here is the snippet which you can user to convert the UTC date value to your local timezone regardless of day light savings
/* mi us your date field in UTC */ DATEADD(mi, DATEDIFF(mi, GETUTCDATE(), GETDATE()), LastModified) AS LastModifiedLocal
No comments:
Post a Comment