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!
精彩评论