What format do I use for Date/Time when writing to an XML file using .NET? Do I simply use DateTime.ToString()
, or do I have to use a specific format?
EDIT: This is bad advice. Use "o", as above. "s" does the wrong thing.
I always use this:
dateTime.ToUniversalTime().ToString("s");
This is correct if your schema looks like this:
Which would result in:
2002-05-30T09:00:00
You can get more information here: http://www.w3schools.com/xml/schema_dtypes_date.asp