Priting DateTime following ISO 8601 spec.
With web services the dateTime type is formatted as point 3.2.7 of the XML schema datatype specification. When you use ASP.NET to develop web services this formatting is done by the XmlSerializer and then you don't have to care about it. But, if you work manually you have two ways to do this job:
- use ToString() method of DateTime
DateTime.Now.ToString("yyyy-MM-ddTHH\\:mm\\:ss.fffffffzzz");
- use ToString() method of SoapDateTime class:
System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime.ToString(dt);