My goal is to use a .NET DateTime object (in C #) and serialize it and parse from a string (for use in XML) in a way that complies with standards. The specific standard that I have in mind is the ISO 8601 standard for representing dates and times.
I want an easy-to-use solution (preferably one call method in any way) that will convert to and from a concatenated version of the format. I would also like to keep local time zone information.
Here is an example of the line I would like to get:
2009-04-15T10: 55: 03.0174-05: 00
My target version of .NET is 3.5.
I really found a solution to this problem a few years ago, which includes a custom format and the DateTime.ToString (string) method. I was surprised that a simpler, standards-compliant solution does not exist. Using custom format strings for serialization and parsing according to standards smells a bit to me.
Waylon flinn
source share