FORMAT attribute

The FORMAT attribute defines the data formatting for numeric and date time fields, for input and display.


FORMAT = "format"
  1. format is a string of characters that specifies a data format.


The FORMAT attribute can be set to define input and display format for numeric and date fields.

When this attribute is not used, environment variables define the default format:
  • For MONEY and numeric fields such as DECIMAL fields, a format can be specified with the DBFORMAT (or DBMONEY) environment variables.
  • For DATE fields, the default format is defined by the DBDATE environment variable.

The data format is used when converting the input buffer to the program variable, and when displaying program variable data to form fields. For example, when defining a FORMAT="yyyy-mm-dd" for a form field bound to a program variable defined as a DATE, the user can input a date as 2013-12-24, and the date value will be displayed in the same manner.

Do not confuse the FORMAT and PICTURE attributes: The PICTURE attribute is used to define an input mask for character string fields, such as vehicle registration numbers. Do not mix PICTURE and FORMAT attributes in field definitions.

If the format string is smaller than the field width, you get a compile-time warning, but the form is usable.

The format string can be any valid string expression using formatting characters as described in Formatting numeric values and Formatting DATE values.


EDIT f001 = order.thedate, FORMAT = "mm/dd/yyyy";