Sign in Join
FPDoc Onlineexperiment

TCustomCalendar.DateTime property

Member of TCustomCalendarpublicIn unit Calendar

Native data type used for a date value on the calendar control.

Declaration

pascal
property DateTime: TDateTime read GetDateTime write SetDateTime;

Description

DateTime is a TDateTime property with the date value for the calendar control. It determines the initial month and year displayed on the control, and the day of the month highlighted at run-time. It is updated (along with Date) when a new date value is selected using the calendar control.

Reading the value for the property causes both Date and DateTime members to be retrieved from the widgetset class when its handle has been allocated. If the handle is not available, the member value is used instead.

Setting a new value for the property causes the TDateTime value to be validated. When MinDate and MaxDate contain non-zero date/time values that are at least one day apart, the property must in the specified range limits. When MinDate and MaxDate are not assigned, the RTL MinDateTime and MaxDateTime constants are used to limit the range for the date value. An EInvalidDate exception is raised when the date value is not valid for the data type, or not within the required range.

FormatDateTime is called to convert the TDateTime value to its string representation in Date. An EConvertError exception is raised if the date is not valid or DefaultFormatSettings contains an invalid ShortDate format.

Changes to the property values are sent to the widgetset class instance when its handle has been allocated. This includes values in the Date, DateTime, MinDate, MaxDate, DisplaySettings, and FirstDayOfWeek properties.

Use the OnChange, OnDayChanged, OnMonthChanged, or OnYearChanged event handlers to perform actions needed when the date (and its component values) has been modified in the widget for the calendar control.

The control does not use the time portion of the TDateTime data type. The time value is not significant unless the specified time is not valid for the date/time data type.

Errors

EConvertError is raised when the value is not a valid for the TDateTime type.

EInvalidDate is raised when the date value is not within the range represented by MinDate and MaxDate; raised with the message rsInvalidDateRangeHint.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.