Skip to main content

UtcDateTimeConverter.ConvertFromStorageType(Object) Method

Converts the stored value from the current coordinated universal time (UTC) to local time.

Namespace: DevExpress.Xpo.Metadata

Assembly: DevExpress.Xpo.v24.2.dll

Declaration

public override object ConvertFromStorageType(
    object value
)

Parameters

Name Type Description
value Object

An object which represents the value to convert.

Returns

Type Description
Object

An object which represents the converted value. null (Nothing in Visual Basic) if the specified value is a null reference.

Remarks

The ConvertFromStorageType method returns a value which is converted from the current coordinated universal time (UTC) to local time.

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