从 Dynamics CRM 返回什么 DateTime API

What DateTime is returned from Dynamics CRM API

从 Dynamics CRM Web API 返回的 DateTime 对象是否始终采用 UTC 格式,记录在何处?

我正在使用 CRM SDK nuget 包。我在几个博客(通过 CRM 商店)上读到 CRM API 总是 returns UTC DateTime 对象并且我经历过 DateTime.Kind 总是 UTC(根据我的测试)但是 我需要确定。

如果重要的话,CRM 是 2015 年。

我正在使用以下代码调用 Dynamics CRM Web 服务。

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

querybyattribute.Attributes.AddRange(attributeName);
querybyattribute.Values.AddRange(attributeValue);

然后调用 RetreiveMultiple

EntityCollection entities;
using (var proxy = new ManagedTokenOrganizationServiceProxy(serviceManagement, credentials))
{
    entities = proxy.RetrieveMultiple(query);
}

"In Web services (SDK), these values are returned using a common UTC time zone format. "

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

CRM 中的日期具有三种不同类型的行为。其中只有两个真正具有时区的概念。三种类型的行为可以在MSDN上找到,相关部分复制在这里:

UserLocal(这是 CRM 2015 pre Update 1 中唯一可用的)

The retrieve operation returns the UTC value.

仅限日期

For the retrieve and update operations, no time zone conversion is performed, and the time value is always 12 AM (00:00:00).

TimeZoneIndependent

For the retrieve and update operations, no time zone conversion is performed, and actual date and time values are returned and updated respectively in the system regardless of the user time zone.