RAD Studio VCL Reference
|
Specify format for date-time string.
property Format: String;
__property AnsiString Format;
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"). |
To include literal strings in the format, enclose them in single quotes. Failing to quote literal strings can have unpredictable results, even if they do not include formatting codes. Use two single quotes to represent one single quote character in a literal string. For example,
'Today''s date:' MMM dd, yyyy
entered in the property editor, produces the following results for April 1, 2001:
"Today's date: Apr 01, 2001"
DateTimePicker1.Format := '''Today''''s date:'' MMM dd, yyyy';
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|