UtcDateTimeConverter Class
In This Article
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.v24.2.dll
NuGet Package: DevExpress.Xpo
#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); }
}
}
#Inheritance
Object
ValueConverter
UtcDateTimeConverter
See Also