November Happy Hour will be moved to Thursday December 5th.

Class DatabaseDateTimeHandler

Helper class to convert datatime from and to database.

Inheritance
System.Object
DatabaseDateTimeHandler
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Data
Assembly: EPiServer.Data.dll
Version: 9.12.2
Syntax
public abstract class DatabaseDateTimeHandler

Constructors

DatabaseDateTimeHandler()

Declaration
protected DatabaseDateTimeHandler()

Properties

DatabaseDateTimeKind

Property for DatbaseDataTimeKind

Declaration
public virtual DatabaseDateTimeKind DatabaseDateTimeKind { get; protected set; }
Property Value
Type Description
DatabaseDateTimeKind

Methods

ConvertFromDatabase(Object)

Convert value from database to datetime according to DatabaseDateTimeKind. If the DatabaseDateTimeKind is DatabaseDateTimeKind.Local is be converted to local otherwise to utc.

Declaration
public virtual DateTime? ConvertFromDatabase(object value)
Parameters
Type Name Description
System.Object value

the database datetime value

Returns
Type Description
System.Nullable<System.DateTime>

Converted to datetime according to the DatabaseDateTimeKind.

ConvertFromDatabase(Object, DatabaseDateTimeKind)

Convert value from database to datetime according to DatabaseDateTimeKind. If the DatabaseDateTimeKind is DatabaseDateTimeKind.Local is be converted to local otherwise to utc.

Declaration
public abstract DateTime? ConvertFromDatabase(object value, DatabaseDateTimeKind databaseDateTimeKind)
Parameters
Type Name Description
System.Object value

the database datetime value

DatabaseDateTimeKind databaseDateTimeKind

The database datetime kind.

Returns
Type Description
System.Nullable<System.DateTime>

Converted to datetime according to databaseDateTimeKind

ConvertToDatabase(DateTime)

Convert value to database to datetime according to DatabaseDateTimeKind. If the DatabaseDateTimeKind is DatabaseDateTimeKind.Local is be converted to local otherwise to utc.

Declaration
public virtual DateTime ConvertToDatabase(DateTime value)
Parameters
Type Name Description
System.DateTime value

the date

Returns
Type Description
System.DateTime

Converted to datetime according to the DatabaseDateTimeKind.

ConvertToDatabase(DateTime, DatabaseDateTimeKind)

Convert value to database to datetime according to DatabaseDateTimeKind. If the DatabaseDateTimeKind is DatabaseDateTimeKind.Local is be converted to local otherwise to utc.

Declaration
public abstract DateTime ConvertToDatabase(DateTime value, DatabaseDateTimeKind databaseDateTimeKind)
Parameters
Type Name Description
System.DateTime value

the date

DatabaseDateTimeKind databaseDateTimeKind

The database datetime kind.

Returns
Type Description
System.DateTime

Converted to datetime according to databaseDateTimeKind

Extension Methods