FormatDateEx(Value: DateTime; Format: String): String;
Value. Value converted to string type.
Format. Format, according to which the Value value is to be converted.
The FormatDateEx method converts the specified date value into string type according to the selected format and taking into account regional standard settings.
The format uses the following codes:
| Code | Description |
| d | Day of month. One-figure day values shown with or without preceding zero. |
| dd | Day of month. One-figure day values that must be shown with preceding zero. |
| ddd | Abbreviated day names as Sun-Mon. |
| dddd | Full weekday names as Sunday-Monday. |
| M | Numeric month view. One-figure month values shown with or without preceding zero. |
| MM | Numeric month view. One-figure month values that must be shown with preceding zero. |
| MMM | Abbreviated month names as Jan - Dec. |
| MMMM | Full month names as January - December. |
| y | Two-digit year. One-figure year values shown with or without preceding zero. |
| yy | Two-digit year. One-figure year values that must be shown with preceding zero. |
| yyyy | Four-digit year, including century. |
Sub FormatDate;
Var
c: ICultureInfo;
d: DateTime;
s: String;
Begin
c := CultureInfo.Current;
d := DateTime.Parse("01.01.2006 00:00:00");
s := c.FormatDateEx(d, "dd MMMM yyyy years");
End Sub FormatDate;
After executing the example the date "01.01.2006" will be converted into format "dd MMMM yyyy year" according to regional standard settings.
See also: