In french: HeureVersChaîne
Converts a time to a string in the specified format.
// Convert the specified time according to the "HH:MM:SS:CC" format
TimeToString("12005956") // Returns "12:00:59:56"
Left(TimeToString("12005956"), 5) // Returns "12:00"
<Result> = TimeToString(<Time to convert> [, <Format>])
<Result>: Character string
Character string in the specified format.
<Time to convert>: Character string, Date or DateTime variable
Time to use. This time can correspond to:
- a character string in HHMMSSCC format (HH corresponds to hours, MM to minutes, SS to seconds and CC to hundredths of a second).
- a character string in YYYYMMDDHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to hours, mm to minutes, SS to seconds and CC to hundredths of a second). In this case, only the time is taken into account.
- a Time variable.
- a DateTime variable. In this case, only the time is taken into account.
<Format>: Optional character string
Format that must be applied to the time. This parameter corresponds to:
- a character string (a sentence for example). The specific characters representing the different elements of the time (HH, MM, SS, CC or AP) will be automatically replaced with their value identified in the <Time> string. In this string:
- HH represents the number of hours,
- MM represents the number of minutes,
- SS represents the number of seconds,
- CC represents the number of hundredths of a second,
- AP represents "AM" or "PM" (if "AP" is used, the time is displayed in 12-hour format).
- the maskSystemTime constant. This constant allows you to directly use the mask used by the system time.
This constant is not available.
If this parameter is not specified, the result is in HH:MM:SS:CC format.
The time validity passed as parameter is checked. A message is displayed if the time is invalid. You can check the validity of a time using TimeValid
Tip: To have a valid time in a string, the time must be entered in a Time Edit control.
is used to format a time returned by IntegerToTime
. The result can be assigned to a text control, for example.
Business / UI classification: Neutral code
This page is also available for…