format
format(picture: String): String;
The format method of the Time primitive type returns a string containing the time in the format specified in the picture parameter and current locale settings for time markers (AM/PM). For example:
testTimeFormat(); vars time : Time; begin write "The time now is " & time.format("hh.m:ss tt"); end;
The example shown in this method writes The time now is 08.41:08 a.m. (if the Time regional setting for that user locale has the AM symbol specified as a.m.).
Use the string picture elements listed in the following table to construct time format picture strings. Separate each element with a space or a separator character; for example, a period (.) or a colon character (:).
Picture | Description | Output Format |
---|---|---|
h | Hours, with no leading zero (12-hour clock) | 8 |
hh | Hours, with a leading zero (12-hour clock) | 08 |
H | Hours, with no leading zero (24-hour clock) | 13 |
HH | Hours, with a leading zero (24-hour clock) | 08 |
m | Minutes, with no leading zero | 6 |
mm | Minutes, with leading zero | 06 |
s | Seconds, with no leading zero | 47 |
ss | Seconds, with leading zero | 07 |
t | One-character time marker string of the current locale | p |
tt | Multiple-character time marker string of the current locale | PM |
In this table, the t and tt picture elements are determined by the AM symbol or PM symbol for the current locale of the user (defined by using the AM symbol or PM symbol combo box in the Time sheet of the Regional Settings Properties dialog, accessed from the Regional Settings icon in the Control Panel).
You can use the
If you do not define the