Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
SaveAsXml(Stream stream, bool serializeDatesAsUniversalTime)
posted

Hi

I Tried to save appointment with  SaveAsXml(stream,true) as the following code:

MemoryStream stream = new MemoryStream();

initialAppointment.SaveAsXml(stream,

true);

 

 

 

 and i got the following exception :

A UTC DateTime is being converted to text in a format that is only correct for local times. This can happen when calling DateTime.ToString using the 'z' format specifier, which will include a local time zone offset in the output. In that case, either use the 'Z' format specifier, which designates a UTC time, or use the 'o' format string, which is the recommended way to persist a DateTime in text. This can also occur when passing a DateTime to be serialized by XmlConvert or DataSet. If using XmlConvert.ToString, pass in XmlDateTimeSerializationMode.RoundtripKind to serialize correctly. If using DataSet, set the DateTimeMode on the DataColumn object to DataSetDateTime.Utc.

 

What can i do to solve this exception?

Please advise.

Thanks.

  • 71886
    Offline posted

    Hello tomert,

    I have created the following case for you:

    CAS-70749-ZSLC4S. I will provide you further details regarding the desired behavior through your case.


    Please feel free to let me know if you need any assistance or if you have any other questions.