开发者

Preserving DateTime values in DataSet returned from WCF service

I am returning a DataSet from a WCF web service to the client. The server and client are in different time zones. Some DateTime columns are the server开发者_JAVA技巧's local time, others are in UTC.

The problem is the DateTime values in the returned DataSet get converted to client's local time. Is there a way to preserve the DateTime values that the server is sending back?


Return DateTimeOffset.


You should always use UTC relative datatimes. Make sure that the Kind property is set to DateTimeKind.Utc. If not then WCF tries to convert to the local timezone any datetime fields!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜