format
format(picture: String): String;
The format method of the Date primitive type returns the receiver as a string formatted in the date format specified in the picture parameter.
If the
If EnhancedLocaleSupport is set to true, the format method can format dates in the range 1 January 100 to 31 December 30827 correctly.
If EnhancedLocaleSupport is set 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.
The following examples show the use of the format method.
vars date : Date; begin write "The date today is " & date.format("dd.MM.yyyy"); end; if cd.lastPlayed = null then form.lastPlayed.caption := "Never"; else form.lastPlayed.caption := cd.lastPlayed.format("dd-MMM-yy"); endif;
The picture parameter is the string value of the required format. The month is denoted by uppercase letters (that is, MM) to differentiate it from minutes (that is, mm).
Use the string picture elements listed in the following table to construct date format picture strings. Separate each element with a space or separator character.
Picture | Description | Output Format |
---|---|---|
d | Day of month as digits, with no leading zero | 9 |
dd | Day of month as digits, with a leading zero | 09 |
ddd | Day of week as an abbreviation as specified in the locale definition, usually three letters | Mon |
dddd | Day of week as the full name | Wednesday |
M | Month as digits, with no leading zero | 6 |
MM | Month as digits, with leading zero | 08 |
MMM | Month as an abbreviation as specified in the locale definition, usually three letters | Mar |
MMMM | Month as the full name | September |
y | Year, represented by only the last digit if less than 10, else yy | 6 |
yy | Year, represented by only the last two digits | 97 |
yyy | Year, represented by all significant digits | 1998 |
For example, to return a date string of Wed Aug 04 99, use the following picture string as your picture parameter for the format method of the Date primitive type.
ddd MMM dd yy
The locale information for each country is supplied embedded with the operating system. For example, the MMM format of an English locale returns the month as a three-letter abbreviation (for example, Apr) and the ddd format as a three-letter abbreviation (for example, Mon). The MMM format of a French locale can vary from three letters to four letters and a character (for example, mai, mars, or janv.) and the ddd format always returns three letters and a character (for example, lun.).