简体   繁体   English

在MS Dynamics CRM中显示的日期与SQL-Server不同

[英]Date Showing Up Different in MS Dynamics CRM than that of SQL-Server

My string dates are as follows in YYYYMM format: 我的字符串日期如下YYYYMM格式:

201008
201009
201010
201011
201012
...

The following is my CONVERT statement in my stored procedure: 以下是我的存储过程中的CONVERT语句:

CONVERT (datetime, @FileName + '01', 112)

my results are showing up fine in SQL-Server as follows 我的结果在SQL-Server中显示如下

2010-10-01
2010-11-01
2010-12-01
...

However, in MS Dynamics CRM they are showing up as the last day a month earlier (corresponding with the previous SQL-Server results) as follows: 但是,在MS Dynamics CRM中,它们显示为一个月前的最后一天(与之前的SQL-Server结果相对应),如下所示:

9/30/2010
10/31/2010
11/30/2010
...

What the heck is going on here? 到底发生了什么事?

You always have to remember that CRM stores the dates in UTC, but displays them as the users's timezone: 您始终必须记住CRM以UTC格式存储日期,但将其显示为用户的时区:

So for your example, when you're working in SQL the Date Time is in UTC, but when you look at CRM it's in your local time. 因此,对于您的示例,当您在SQL中工作时,日期时间是UTC,但是当您查看CRM时,它就在您当地时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM