title: How to serialize to dateTime
body: <p>Working to get DateTimes for any time zone. 
  I'm using DateTimeOffset, and a string, and an XmlElement attribute. When I do, I get the following error:</p>
  
  <blockquote>
    <p>[InvalidOperationException: 'dateTime'
    is an invalid value for the
    XmlElementAttribute.DataType property.
    dateTime cannot be converted to
    System.String.]<br>
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext
    context, String dataType,
    XmlAttributes a, Boolean repeats,
    Boolean openModel, RecursionLimiter
    limiter) +450</p>
    
    <p>[InvalidOperationException: There was
    an error reflecting type
    'System.String'.]<br>
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext
    context, String dataType,
    XmlAttributes a, Boolean repeats,
    Boolean openModel, RecursionLimiter
    limiter) +1621<br>
    System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping
    accessor, FieldModel model,
    XmlAttributes a, String ns, Type
    choiceIdentifierType, Boolean rpc,
    Boolean openModel, RecursionLimiter
    limiter) +8750<br>
    System.Xml.Serialization.XmlReflectionImporter.ImportFieldMapping(StructModel
    parent, FieldModel model,
    XmlAttributes a, String ns,
    RecursionLimiter limiter) +139<br>
    System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping
    mapping, StructModel model, Boolean
    openModel, String typeName,
    RecursionLimiter limiter) +1273</p>
    
    <p>[InvalidOperationException: There was
    an error reflecting property
    'creationTimeX'.] ...</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code> [System.Xml.Serialization.XmlElement(ElementName = "creationTime",
        DataType="dateTime")]
   public string creationTimeX
      {
          get
          {
              return this.creationTimeField.ToString("yyyy-MM-ddTHH:mm:sszzz");
          }
          set
          {
              DateTimeOffset.TryParse(value, out this.creationTimeField);
          }
      }
  
  [System.Xml.Serialization.XmlIgnoreAttribute()]
  public System.DateTimeOffset creationTime
  {
      get {
          return this.creationTimeField;
      }
      set {
          this.creationTimeField = value;
      }
  }
  </code></pre>