How to ignore timezone of DateTime in .NET WCF client?

后端 未结 2 487
一个人的身影
一个人的身影 2020-12-09 06:24

WCF client is receiving a Date value from a Java web service where the date sent to the client in XML is :

2010-05-10+14:00         


        
2条回答
  •  情书的邮戳
    2020-12-09 06:39

    Try this

    DateTime newDate = DateTime.SpecifyKind(oldDate, DateTimeKind.Unspecified);
    

    Coding Best Practices Using DateTime in the .NET Framework

    Related links

    http://daveonsoftware.blogspot.com/2008/07/wcf-datetime-field-adjusted.html

    http://social.msdn.microsoft.com/forums/en-US/wcf/thread/36ae825a-ffc6-4ac3-9981-c82692039d58

    Best practices for DateTime serialization in .NET 3.5

提交回复
热议问题