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.v21.2.dll

Declaration

public class UtcDateTimeConverter :
    ValueConverter

Remarks

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

Example

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); }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the UtcDateTimeConverter class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

Object
ValueConverter
UtcDateTimeConverter
See Also