What DateTime is returned from the Dynamics CRM API

Are the DateTime objects returned from the Dynamics CRM web API always in UTC and where is this documented?

I am using the nuget CRM SDK. I read on several blogs (on CRM stores) that the CRM API always returns UTC DateTime objects, and I experienced that DateTime.Kind is always UTC (from my testing), but I need to know for sure.

CRM is 2015, if that matters.

I call Dynamics CRM Web Services with the following code.

var querybyattribute = new QueryByAttribute() { EntityName = Opportunity.EntityLogicalName, ColumnSet = new ColumnSet(true)//all columns }; querybyattribute.Attributes.AddRange(attributeName); querybyattribute.Values.AddRange(attributeValue); 

And then calling RetreiveMultiple

 EntityCollection entities; using (var proxy = new ManagedTokenOrganizationServiceProxy(serviceManagement, credentials)) { entities = proxy.RetrieveMultiple(query); } 
+5
source share
2 answers

There are three different types of behavior for dates in CRM. Only two of them really have a time zone concept. The behavior of the three types can be found on MSDN with the corresponding parts copied here:

UserLocal (this is the only one available in CRM 2015 pre Update 1)

The retrieve operation returns a UTC value.

Dateonly

For receive and update operations without changing the time zone, the time value is always 12 AM (00:00:00).

TimeZoneIndependent

For receive and update operations without changing the time zone, the actual date and time values ​​are returned and updated accordingly in the system, regardless of the user's time zone.

+5
source

"In Web Services (SDK), these values ​​are returned using the common UTC time zone format."

https://technet.microsoft.com/en-us/library/dn946904.aspx

+2
source

All Articles