DateTime to string

Feb 7, 2013 at 4:14 PM
Edited Feb 7, 2013 at 4:15 PM
Hi,

I am saving XML files using Linq to XSD that contains DateTime objects.
I have observed that the format of the date time in the output file depends on the DateTimeKind of the C# DateTime object.

Ex :
2013-02-12 when Unspecified
2013-02-12+01:00 when Local (I am in Utc +1)
2013-02-12Z when Utc

What method is used to generate these strings? Is it also Culture dependent?
I cannot reproduce this behaviour with any DateTime method and none of the formats given by GetDateTimeFormats method match these formats.