Posts

Showing posts from July, 2017

Microsoft Dynamics CRM Time zones

Time Zones Dynamics CRM stored Date/Time fields in the database as a SQL datetime field that is always converted to a UTC date.  Each user has a Time Zone Code associated with their user settings. ·          To list all the available TimeZoneCodes use the following query against the MSCRM database: SELECT TimeZoneCode, UserInterfaceName FROM TimeZoneDefinition order by UserInterfaceName ·          To list all user's selected Time Zone Code use: Select SystemUserId, TimeZoneCode from UserSettings There functions available in the MSCRM database for converting to and from UTC to local dates. The following function accepts a utc date and converts it to a local date based on the time zone code matching those in TimeZoneDefinition. dbo.fn_UTCToTzCodeSpecificLocalTime(@utc,@timezonecode) Dates are stored as UTC Consider the following: ·        ...