The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.

UtcDateTimeConverter Class

Represents a converter which can be used to convert DateTime objects from the local time to the current coordinated universal time (UTC).

Namespace: DevExpress.Xpo.Metadata

Assembly: DevExpress.Xpo.v19.2.dll

Declaration

public class UtcDateTimeConverter :
    ValueConverter
Public Class UtcDateTimeConverter
    Inherits ValueConverter
public class UtcDateTimeConverter :
    ValueConverter
Public Class UtcDateTimeConverter
    Inherits ValueConverter

Remarks

For more information on converters, see the ValueConverter class description.

Examples

The following example shows how to convert the value of the Date property from the local time to the current coordinated universal time (UTC) when persisting it in a data store.

using DevExpress.Xpo;
using DevExpress.Xpo.Metadata;
// ...
public class SampleUtc : XPObject {
    private DateTime date;
    [ValueConverter(typeof(UtcDateTimeConverter))]
    public DateTime Date {
        get { return date; }
        set { SetPropertyValue(nameof(Date), ref date, value); }
    }
}

Inheritance

Object
ValueConverter
UtcDateTimeConverter
See Also