RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TDateTimeField.DisplayFormat Property

Controls the formatting of the date-time field for display purposes.

Pascal
property DisplayFormat: string;
C++
__property AnsiString DisplayFormat;

Use DisplayFormat to specify the formatting string to use for formatting the value in a date-time field when the field's value appears as a string. If DisplayFormat is not assigned a string, the value is formatted according to the default date-time format specified by the Windows Control Panel.

Note: DisplayFormat does not affect the value of the AsString property.
Construct a DisplayFormat string using these format specifiers:

Specifier 
Displays 
c  
The date using the format given by the ShortDateFormat global variable, followed by the time using the format given by the LongTimeFormat global variable. The time is not displayed if the fractional part of the DateTime value is zero.  
d  
The day as a number without a leading zero (1-31).  
dd  
The day as a number with a leading zero (01-31).  
ddd  
The day as an abbreviation (Sun-Sat) using the strings given by the ShortDayNames global variable.  
dddd  
The day as a full name (Sunday-Saturday) using the strings given by the LongDayNames global variable.  
ddddd  
The date using the format given by the ShortDateFormat global variable.  
dddddd  
The date using the format given by the LongDateFormat global variable.  
m  
The month as a number without a leading zero (1-12). If the m specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.  
mm  
The month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.  
mmm  
The month as an abbreviation (Jan-Dec) using the strings given by the ShortMonthNames global variable.  
mmmm  
The month as a full name (January-December) using the strings given by the LongMonthNames global variable.  
yy  
The year as a two-digit number (00-99).  
yyyy  
The year as a four-digit number (0000-9999).  
h  
The hour without a leading zero (0-23).  
hh  
The hour with a leading zero (00-23).  
n  
The minute without a leading zero (0-59).  
nn  
The minute with a leading zero (00-59).  
s  
The second without a leading zero (0-59).  
ss  
The second with a leading zero (00-59).  
t  
The time using the format given by the ShortTimeFormat global variable.  
tt  
The time using the format given by the LongTimeFormat global variable.  
am/pm  
The time using the 12-hour clock for the preceding h or hh specifier, followed by "am" for any hour before noon, or "pm" for any hour after noon. The am/pm specifier can use lower, upper, or mixed case, and the result is displayed accordingly.  
a/p  
The time using the 12-hour clock for the preceding h or hh specifier, followed by "a" for any hour before noon, or "p" for any hour after noon. The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.  
ampm  
The time using the 12-hour clock for the preceding h or hh specifier, followed by the contents of the TimeAMString global variable for any hour before noon, or the contents of the TimePMString global variable for any hour after noon.  
/  
The date separator character given by the DateSeparator global variable.  
:  
The time separator character given by the TimeSeparator global variable.  
'xx'/"xx"  
Characters enclosed in single or double quotes are displayed as-is, with no formatting changes.  

Format specifiers may be written in uppercase or lowercase letters; both produce the same result. 

If the string given by the Format parameter is empty, the date and time value is formatted as if a c format specifier had been given. 

 

AsString

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!