ICultureInfo.FormatTimeEx

Syntax

FormatTimeEx(Value: DateTime; Format: String): String;

Parameters

Value. Date and time value converted into string type.

Format. Format, according to which the Value value is to be converted.

This format uses the following codes:

Code Description
h Hour in a 12-hour clock. No zero is shown before one-figure hour values.
hh Hour in a 12-hour clock. A zero is shown before one-figure hour values.
H Hour in a 24-hour clock. No zero is shown before one-figure hour values.
HH Hour in a 24-hour clock. A zero is shown before one-figure hour values.
m Minute. No zero is shown before one-figure minute values.
mm Minute. A zero is shown before one-figure minute values.
s Second. No zero is shown before one-figure second values.
ss Second. A zero is shown before one-figure second values.
f Tenths of second.
ff Hundredths of second.
fff Thousandths of second.
F If a non-zero value, tenths of second.
FF If a non-zero value, hundredths of second.
FFF If a non-zero value, thousandths of second.

Description

The FormatTimeEx method converts the specified time value into string format according to the determined format and taking into account regional standard settings.

Example

Sub UserProc;
Var
    CI: ICultureInfo;
    d: DateTime;
    s: String;
Begin
    CI := CultureInfo.Current;
    d := DateTime.Parse("01.01.2000 07:45:39");
    s := CI.FormatTimeEx(d, "H hours mm minutes ss seconds");
End Sub UserProc;

After executing the example the date "01.01.2006 07:45:39" will be converted into the format "H hours mm minutes ss seconds" according to regional standard settings.

See also:

ICultureInfo