Class DatabaseDateTimeHandler
Helper class to convert datatime from and to database.
Inheritance
Namespace: EPiServer.Data
Assembly: EPiServer.Data.dll
Version: 12.0.3Syntax
public abstract class DatabaseDateTimeHandler : Object
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 Nullable<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 Nullable<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 |
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 |