Microsoft Dynamics CRM Date and Time can be very confusing and challenging to work with, especially in scheduling applications. We have solved several challenges with DateTimes and time zones in both CRM Forms and custom portals.
A few CRM Date and Time truths that we have learned along the way:
- CRM DateTime always comes with time component. There is a setting in creating a DateTime field that defines date only, but all that does is default the time to midnight local time
- DateTime is saved in database as UTC time
- DateTime in CRM UI is always shown based on user’s local time zone. This is true even if UI is only showing the date component. This leads to following effect:
- If user in CST enters contact’s birthdate as 2/2/1980, this is saved as 2/2/1980 05:00 in DB
- If user in PST views the contact record, he/she will see the birthdate as 2/1/1980 (because local time for the user will be 2/1/1980 22:00)
- DateTime retrieved through CRM Web Services is always UTC time
- DateTime set through CRM Web Services is user’s local time zone by default
- Note that extra care must be taken to understand whether the call is done with the calling user or a service user
- DateTime set through CRM Web Services can be defined to be UTC instead
- DateTime queried directly from SQL table or base view returns UTC
- DateTime queried from filtered view returns users local time
Just a few fun tidbits from your friendly CRM Experts at PowerObjects.
Happy CRM’ing!
I was having quite a good morning working on my CRM system, and now my head hurts. Thank goodness it's lunchtime (somewhere!).
Searching Date time in CRM 2011 is pain... Its set in different format (in system settings as well as local settings) but search is happening in different 🙁
Hi, you say "DateTime set through CRM Web Services can be defined to be UTC instead" - how do you this please?
Hi everyone,
Has anyone tried that? I am creating an entity via REST service and setting the datetime field with "2016-02-26T17:01:00Z" expecting that CRM will treat this as UTC time but the outcome in DB is "2016-02-27 03:35:00.000"
Hi! Happy New Year! How do you "DateTime set through CRM Web Services can be defined to be UTC"? I have this long running web service program that imports data to CRM Online, now I encounter an Unsecured Fault Error, I suspect the problem has got to do with timezones as I have research online. So I sync my local time to the timezone my CRM Online server is using and it solved the problem. But that is not a permament solution. I got to somehow imporsonate as I were using the server time rather than local time.
Hi Joe,
I wrote a blog post about this way back in 2011 which may help provide some additional information:
https://community.dynamics.com/crm/b/develop1/archive/2011/12/06/dynamics-crm-datetimes-the-last-word.aspx
Really petty problem, system jobs all show as +1 hour from system time? Help Required!
Hi Daniel - With crm 2015 update 1.0 OR crm 2016 we now have a very elegant solution -- date only fields. We can have fields with date that are not affected by time zone. https://powerobjects.com/blog/2015/07/15/dynamics-crm-2015-spring-update-1-date-and-time-data-type/
Hi Daniel - With crm 2015 update 1.0 OR crm 2016 we now have a very elegant solution -- date only fields. We can have fields with date that are not affected by time zone. https://powerobjects.com/blog/2015/07/15/dynamics-crm-2015-spring-update-1-date-and-time-data-type/
When testing the date and time field out. It seems when a user manually enters time into the field and presses tab/enter, the field is not updated. But if I type in a time manually and click out of the box it sticks. How do we get the time to stick when tabbing or entering?
We are seeing the same behavior. We are running Dynamics CRM 2016. Has anyone else experienced this or resolved it?
Hi Ray - what browser are you using? i just tested this in a 2016 org and seemed ok.
Hi Joe, I have the same problem. We are running CRM 2016 and I have tested in both IE and Chrome.