FORMAT
You can use the FORMAT attribute with a DECIMAL, SMALLFLOAT, FLOAT, or DATE
field to control the format of output displays.
field-tag is the field tag that you declared in the SCREEN section.
format-string is a string of characters to specify a data display format. You must enclose
format-string within quotation ( " ) marks.
This attribute can format data that the application displays in the field.
(Use the PICTURE attribute to format data that are entered in the field by the
user.) INFORMIX-4GL displays the data right-justified in the field.
If the format-string is smaller than the field width, the Form Compiler issues
a compile-time warning, but the form is usable.
Formatting DATE Values
For DATE data types, INFORMIX-4GL recognizes the following symbols as special
in the format-string:
mm produces the two-digit representation of the month; for example, Jan = 01, Feb
= 02, and so on.
mmm produces a three-letter English language abbreviation of the month; for
example, Jan, Feb, and so on.
dd produces the two-digit representation of the day of the month.
ddd produces a three-letter English language abbreviation of the day of the week;
for example, Mon, Tue, and so on.
yy produces the two-digit representation of the year, discarding the leading
digits. The year 2003, for example, would appear as 03.
yyyy produces a four-digit representation of the year.
For DATE fields, the Form Compiler interprets any other characters as
literals, and displays them wherever you place them within format-string.
Formatting Number Values
For DECIMAL, SMALLFLOAT, or FLOAT data types, the format-string consists of
pound signs (#) that represent digits, and a decimal point. For example, "###.##"
produces at least three places to the left of the decimal point and exactly
two to the right.
If the actual number displayed requires fewer characters than the
format-string, 4GL right-justifies it, and pads the left with blanks.
If necessary to satisfy the format string, 4GL rounds number values before it
displays them.
Related Attributes