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 defineTimeFormat method of the TimeFormat class if you want to create your own transient format objects and define a time format that dynamically overrides the format for the locale at run time. (For details, see Chapter 1 of the JADE Encyclopaedia of Classes.)

If you do not define the EnhancedLocaleSupport parameter in the [JadeEnvironment] section of the JADE initialization file on the database node or you set it to false, inconsistent results could be returned to the application server when running in JADE thin client mode and there are locale overrides, as all overrides on the application server are suppressed if enhanced locale support is not enabled. Formatting of locale data is done on the application server, based on the locale of the corresponding presentation client.