简体   繁体   中英

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'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?

返回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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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