Previous Topic

Next Topic

Inhoudsopgave

Book Index

TDateTimePicker Control

TDateTimePicker

Description

Displays a list box for entering dates or times.

Remarks

TDateTimePicker is a visual control designed specifically for entering dates or times. It resembles a list box or combo box, except that the drop-down list is replaced with a calendar illustration. Users can select a date from the calendar. Dates or times can also be selected by scrolling with ARROW UP and ARROW DOWN and by typing.

TDateTimePicker formats date and time values according to the date and time settings in the Regional Settings of the Control panel on the user's system.

TDateTimePicker Properties

Property Property DateFormat: Enumerated (R/W)

Specifies format in which the date is presented. If DateFormat is set to dfShort, the date is formatted using the short date format specified in the Windows control panel. By default, it appears like this: 3/10/05. If DateFormat is set to dfLong, the date is formatted using the long date format specified in the Windows control panel. By default, it appears like this: Friday, March 10, 2005. (Applies only when Kind is dtkDate.) For custom date formats, set the Format property.

Property Property DateMode: Enumerated (R/W)

Determines the method of date selection used by the component. If DateMode is dmComboBox, the component has a drop-down calendar illustration from which the user can select a date. If DateMode is dmUpDown, the component has Up/Down arrows with which the user can adjust the date. (Applies only when Kind is dtkDate.)

Property Property Format: String (R/W)

Specify format for date-time string. Format specifies custom format string for the date-time display, overriding the control panel strings. A custom format can include both date and time fields, but time fields are not editable unless the Kind property is dtkTime. The following format characters are understood.

Element

Description

d

The one- or two-digit day.

dd

The two-digit day. Single-digit day values are preceded by a zero.

ddd

The three-character weekday abbreviation.

dddd

The full weekday name.

h

The one- or two-digit hour in 12-hour format.

hh

The two-digit hour in 12-hour format. Single-digit values are preceded by a zero.

H

The one- or two-digit hour in 24-hour format.

HH

The two-digit hour in 24-hour format. Single-digit values are preceded by a zero.

m

The one- or two-digit minute.

mm

The two-digit minute. Single-digit values are preceded by a zero.

M

The one- or two-digit month number.

MM

The two-digit month number. Single-digit values are preceded by a zero.

MMM

The three-character month abbreviation.

MMMM

The full month name.

t

The one-letter AM/PM abbreviation (that is, AM is displayed as "A").

tt

The two-letter AM/PM abbreviation (that is, AM is displayed as "AM").

yy

The last two digits of the year (that is, 2001 would be displayed as "01").

yyyy

The full year (that is, 2001 would be displayed as "2001").

Property Property Kind: Enumerated (R/W)

Determines whether the component is a date selector or a time selector. If the Kind property is dtkDate, the control is configured to support date editing. The default format gives only the date portion of the control value, and a drop-down calendar is available if the DateMode property is dmComboxBox. If the Kind property is dtkTime, the control is configured to support time editing. The default format give only the time portion of the control value, but the date portion can also be edited if the Format property includes date field codes.

Property Property Time: TDateTime (R/W)

Indicates the time entered by the user. Applies only when Kind = dtkTime.

Property Property Date: TDateTime (R/W)

Indicates the date that is marked on the calendar. Use Date to get or set the date that is marked on the calendar. The value of Date must lie within the range specified by the MaxDate and MinDate properties.

Property Property DateTime: TDateTime (R/W)

Indicates the date that is marked on the calendar. Use DateTime to get or set the date (and, if relevant, time) that is marked on the calendar control. The value of DateTime must lie within the range specified by the MaxDate and MinDate properties. If MultiSelect is true, the selected range of dates goes from DateTime to EndDate. You can also set the marked date with the Date property.

Property Property MaxDate: TDateTime (R/W)

Indicates the maximum date to which users can scroll the calendar. Use MaxDate to get or set the maximum date to which users can scroll the calendar. The values of the Date and EndDate properties cannot exceed MaxDate.

Property Property MinDate: TDateTime (R/W)

Indicates the minimum date that can be selected. Use MinDate to get or set the minimum date that can be selected.