[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'EditBtn' (#lcl)

# TTimeEdit.TimeFormat

Specifies the time format used to generate the display Text for the time edit control.

## Declaration

Source position: editbtn.pas line 816

`published property TTimeEdit.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.

## Version info

Added in LCL version 4.0.

## See also

TTimeEdit.Text |  | Contains the formatted text used to represent the Time value for the control.
TTimeEdit.Time |  | Represents the time value in the control.
TTimeEdit.TimeSeparator |  | Specifies the separator character used to delimit time parts in the format settings applied to the control.
TTimeEdit.TimeAMString |  | Specifies the value displayed for a 12-hour time value prior to midday (Noon).
TTimeEdit.TimePMString |  | Specifies the value displayed for a 12-hour time value after midday (Noon).
TTimeEdit.ValidTimeFormat |  | Indicates whether the specified value is a valid time format for the TTimeEdit control.
FormatDateTime
FormatChars