Hello,
I am upgrading a .Net Framework 1.1 application that uses an XML document and writes this document to a file. One of the fields in the document has the xml datatype dateTime. This dateTime is output in a format containing 7 digits for the fractions of the seconds (yyyy-mm-ddThh:mm:ss.sssssss+timezone). As the dateTime we use is only accurate to the minute, the seconds and fractions of seconds remain zero and are output as zeros.
After compiling the application with the .Net Framework 2.0 this changes. If the fractions of seconds are zero they are no longer written to the file (the seconds are still written as 00). As we exchange this file with a business partner who requires the fractions of the seconds to successfully parse the file the upgrade breaks our application.
Has anyone had the same behaviour and is there a way to change this back to the old way
Thanks
Daniel

XML DateTime serialization
Ice Age
Does anyone have a workaround other than doing a regex.replace on the serialized string
benny353
We had a similar issue with the change. We change the (yyyy-mm-ddThh:mm:ss.sssssss+timezone) format to SQL format....
Anyway you could use a regular expression (assuming the second fractions are not important):
public string ConvertDataSetXml(string xmlInput){
}
Sgupta
AdrianGodong
Actually a better expression is:
@"( <date>\d{2,4}-\d{1,2}-\d{1,2})T( <time>\d{2}:\d{2}:\d{2})\. \d{0,7}( <zone>(-|\+)\d{2}:\d{2})"
Alex1st
I opened a support call with Microsoft Professional Support on this.
Does anyone have any ideas for a workaround
Daniel
JessicaM
bryanedds
I had this problem, converting datetime to ISO 8601, and I found that simply using DateTime.ToString("s") does the trick. This uses DateTimeFormatInfo.SortableDateTimePattern property. Thanks.
Cale
Henry_2003