This documentation is archived and is not being maintained.

DateTimeSerializationSection.DateTimeSerializationMode Enumeration

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Determines XML serialization format of DateTime objects.

Namespace:  System.Xml.Serialization.Configuration
Assembly:  System.Xml (in System.Xml.dll)

public enum DateTimeSerializationMode

Member nameDescription
DefaultSame as Roundtrip.
RoundtripThe serializer examines individual DateTime instances to determine the serialization format: UTC, local, or unspecified.
LocalThe serializer formats all DateTime objects as local time. This is for version 1.0 and 1.1 compatibility.

This enumeration is used by the serialization infrastructure only, and is not intended for public use. To actually set the serialization mode, create an application configuration file, and set the <dateTimeSerialization> Element to an appropriate setting. For more information about configuration files, see Configuration File Schema for the .NET Framework.

In versions 1.0 and 1.1 of .Net Framework, as well as in versions 2.0 and later when this property is set to Local, DateTime objects are always formatted as the local time. That is, local time zone information is always included with the serialized data. Set this property to Local to ensure compatibility with older versions of the .Net Framework.

In versions 2.0 and later of the .Net Framework, with this property set to Roundtrip DateTime objects are examined to determine whether they are in the local, UTC or an unspecified time zone, and are serialized in such a way that this information is preserved. This is the default behavior and is recommended for all new applications that do not communicate with older versions of the framework.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: