RIA服务+实体 - 提前24小时在客户端移动

时间:2022-04-03 13:58:59

I am currently working on a silverlight project with RIA Services and have seem to come across a bug(or wrote a new one).

我目前正在与RIA Services合作开展一个Silverlight项目,似乎遇到了一个错误(或者写了一个新错误)。

In a simple query I am retrieving a entity model from the server. In the server side service class a DateTime is correct(to what's in the db) but on the client it seems to go back 24 hours and maybe 10 hours...

在一个简单的查询中,我正在从服务器检索实体模型。在服务器端服务类中,DateTime是正确的(对于数据库中的内容),但在客户端上,它似乎可以追溯到24小时甚至10小时......

I have not idea why, it is very strange.

我不明白为什么,这很奇怪。

6/04/2009 12:00:00 AM (Database) turns into 5/04/2009 2:00:00 PM and also displays as 5/4/2009 12:00:00 AM.

6/04/2009 12:00:00 AM(数据库)变成5/04/2009 2:00:00 PM,并显示为5/4/2009 12:00:00 AM。

See attached.....

Is this a bug or a lack of my understanding DateTime?

这是一个错误还是缺乏我对DateTime的理解?

alt text http://www.madhousedesigns.com.au/Custom/Images/CrazyDateTimes.png

alt text http://www.madhousedesigns.com.au/Custom/Images/CrazyDateTimes.png

1 个解决方案

#1


When you retrieve the date, convert the DateTime kind to UTC. This should resolve your issue.

检索日期时,将DateTime类型转换为UTC。这应该可以解决您的问题。

#1


When you retrieve the date, convert the DateTime kind to UTC. This should resolve your issue.

检索日期时,将DateTime类型转换为UTC。这应该可以解决您的问题。