Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Serializing xs:dateTime vs. xs:time UTC issue

$
0
0

Serializing a DateTime using the code below produces some unexpected results. If I specify type as xs:dateTime the result is as expected, i.e. "2009-12-24T08:30:00Z". Now, if I change the type to xs:time, I assumed the result would be "08:30:00Z".... but it is not. I get "08:30:00.0000000+02:00". Don't look like utc to me. What am I missing here?

 

 

class Program
 {staticvoid Main(string[] args)
  {
   UtcDate ud = new UtcDate { EventTime = new DateTime(2009,12,24,8,30,0, DateTimeKind.Utc) };

   XmlSerializer xs = new XmlSerializer(typeof(UtcDate));
   xs.Serialize(Console.Out, ud);
  }
 }publicclass UtcDate
 {//[System.Xml.Serialization.XmlTextAttribute(DataType = "dateTime")] // <- OK, serialized as UTC
  [System.Xml.Serialization.XmlTextAttribute(DataType = "time")]public DateTime EventTime { get; set; }
 }

 



Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>