TTimeEdit.TimeFormat property
Specifies the time format used to generate the display Text for the time edit control.
Declaration
property TimeFormat: string read FTimeFormat write SetTimeFormat;Description
TimeFormat is a
String property which contains
FormatDateTime-compatible specifiers used to generate the Text displayed on the
time edit control. It can be used to override the default time format settings
for a given platform. TimeFormat is used in the UsedTimeFormat method called
when a new value is assigned to the Time property.
TimeFormat can contain only format specifiers accepted by FormatDateTime(), except for those which apply to date or interval parts. The following symbols are interpreted in a specific way:
- 'h', 'H'
- Represents hours.
- 'n', 'N'
- Represents minutes.
- 'm', 'M'
- Represents minutes, but allowed only in conjunction with at least 'h' to avoid misinterpretation as "month".
- 's', 'S'
- Represents seconds.
- 'z', 'Z'
- Represents milliseconds.
- ':'
- Replaced with the value in the TimeSeparator property.
- '.'
- Represents the separator between seconds and milliseconds.
- 'ampm', 'AMPM'
- Formats the time in the 12-hour format, appends the TimeAMString or TimePMString of the DefaultFormatSettings, depending on whether the time is in the first or second half of the day.
- 'a/p', 'am/pm', 'A/P', 'AM/PM'
- Formats the time in the 12-hour format with the corresponding part of the symbol appended for the first or second half of the day.
- 't', 'tt'
- Replaced with the value from ShortTimeFormat or LongTimeFormat in DefaultFormatSettings, respectively.
- 'y', 'Y', 'd', 'D'
- Forbidden because they will introduce date parts.
- '[', ']'
- Forbidden because time interval formatting is not supported by this control.
- Single (') or Double (") quotes
- Symbol replacement is not performed within the quoted substring.
Any other characters can be inserted without quoting unless they collide with those specified above.
Changing the value in TimeFormat causes the new property value to be validated and either accepted or rejected using the ValidTimeFormat method. When accepted, the Text property is updated using the new format settings.
Use TimeSeparator to specify the separator character used to delimit time parts in the format settings.
Use TimeAMString and TimePMString to override the DefaultFormatSettings suffixes used for 12-hour time format.
Added in LCL version 4.0.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
