Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Class PropertyDate

Property representing a System.DateTime value.

Inheritance
System.Object
PropertyDate
Inherited Members
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.Core
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public class PropertyDate : PropertyData, IReadOnly<PropertyData>, IReadOnly
Remarks

This class will render a date selector when put in edit mode using the EPiServer.Web.WebControls.Property webcontrol.

Constructors

PropertyDate()

Initializes a new instance of the PropertyDate class.

Declaration
public PropertyDate()

PropertyDate(DateTime)

Initializes a new instance of the PropertyDate class.

Declaration
public PropertyDate(DateTime date)
Parameters
Type Name Description
System.DateTime date

The initial value.

Properties

Date

Gets or sets the value as a nullable System.DateTime.

Declaration
public DateTime? Date { get; set; }
Property Value
Type Description
System.Nullable<System.DateTime>

The value as a nullable System.DateTime.

MaxValue

Gets the highest value that can be saved.

Declaration
public static DateTime MaxValue { get; }
Property Value
Type Description
System.DateTime

The highest value that can be saved.

Remarks

The highest value is currently 9999-12-31.

MinValue

Gets the lowest value that can be saved.

Declaration
public static DateTime MinValue { get; }
Property Value
Type Description
System.DateTime

The lowest value that can be saved.

Remarks

The lowest value is currently 1753-01-01.

PropertyValueType

Gets the System.Type of the property value.

Declaration
public override Type PropertyValueType { get; }
Property Value
Type Description
System.Type

The System.Type of the property value.

Overrides

Type

Property type as defined by enum PropertyDataType.

Declaration
public override PropertyDataType Type { get; }
Property Value
Type Description
PropertyDataType

The type as defined by enum PropertyDataType.

Overrides

Value

Gets or sets the value of the property.

Declaration
public override object Value { get; set; }
Property Value
Type Description
System.Object

The value of the property.

Overrides
Remarks

Value returns null if the property has no value defined.

Methods

IsValidDate(DateTime)

Determines whether [is valid date] [the specified date].

Declaration
public static bool IsValidDate(DateTime date)
Parameters
Type Name Description
System.DateTime date

The date.

Returns
Type Description
System.Boolean

true if [is valid date] [the specified date]; otherwise, false.

Parse(String)

Creates a PropertyDate from a string.

Declaration
public static PropertyDate Parse(string value)
Parameters
Type Name Description
System.String value

The string to create a PropertyDate from.

Returns
Type Description
PropertyDate

A PropertyDate.

Remarks

If the string is null or Empty an empty PropertyDate is returned. If the string cannot be parsed as a System.DateTime an InvalidPropertyValueException is thrown.

ParseToObject(String)

A wrapper for System.String to return a generic PropertyData object.

Declaration
[Obsolete("ParseToObject is no longer required to be implemented. The same functionality can be achieved by creating a new instance and calling the ParseToSelf method.")]
public override PropertyData ParseToObject(string value)
Parameters
Type Name Description
System.String value

The string to create a PropertyDate from.

Returns
Type Description
PropertyData

A PropertyDate.

Overrides
Remarks

If the string is null or Empty an empty PropertyDate is returned. If the string cannot be parsed as a System.DateTime an InvalidPropertyValueException is thrown.

ParseToSelf(String)

Sets the value of the property to the parsed value.

Declaration
public override void ParseToSelf(string value)
Parameters
Type Name Description
System.String value

The string to create a PropertyDate from.

Overrides
Remarks

If the string is null or Empty an empty PropertyDate is returned. If the string cannot be parsed as a System.DateTime an InvalidPropertyValueException is thrown.

SetDefaultValue()

Sets the default value for this property.

Declaration
protected override void SetDefaultValue()
Overrides

Implements

Extension Methods

EPiServer.Core.PropertyDataExtensions.TranslateDisplayName(EPiServer.Core.PropertyData)
EPiServer.Core.PropertyDataExtensions.TranslateDescription(EPiServer.Core.PropertyData)