【发布时间】:2013-07-30 10:07:48
【问题描述】:
最近,我尝试通过插件从 Invoice 实体中的自定义字段中获取日期时间值,发现它返回的是 CRM 表单中显示日期的前一天。例如,我输入了 "7/1/2013",在我的 C# 中,以下代码返回 "6/30/2013":
EntityReference eRef = new EntityReference(localContext.PluginExecutionContext.PrimaryEntityName, localContext.PluginExecutionContext.PrimaryEntityId);
var invoice = localContext.OrganizationService.Retrieve(eRef.LogicalName, eRef.Id, new ColumnSet(true));
string start = ((DateTime)invoice["revg_startdate"]).ToString(); //here I get 6/30/2013
然后我在相关的 MS SQL 表中检查了实际的日期时间,它恰好保持在前一天,“2013 年 6 月 30 日”
服务器、我的 PC 和 CRM 中的日期、时间和时区完全相同。
为什么 CRM 保留和显示不同的日期?
【问题讨论】:
标签: datetime attributes dynamics-crm-2011