Best practices for DateTime serialization in .NET 3.5

前端 未结 6 1773
执念已碎
执念已碎 2020-12-01 10:45

Some 4 years back, I followed this MSDN article for DateTime usage best practices for building a .Net client on .Net 1.1 and ASMX web services (with SQL 2000 server as the b

6条回答
  •  生来不讨喜
    2020-12-01 11:26

    One big issue is that WCF serialization doesn't support xs:Date. This is a big problem as if all you want is a date, you shouldn't be forced to be concerned about time zones. The following connect issue discusses some of the problems: http://connect.microsoft.com/wcf/feedback/ViewFeedback.aspx?FeedbackID=349215

    If you want to represent a point in time unambiguously, i.e. not just the date part, you can use the DateTimeOffset class if you have .NET 3.5 on both client and server. Or for interoperability, always pass date/time values as UTC.

提交回复
热议问题