Formats of Dates and Money Values Depend on the Locale.

In 4GL the format of DATE and MONEY values depends on the default locale.
If U.S. English is the default locale the following formats are applied:

  • The MONEY values have the dollar ($) sign which precedes the value and the period as the decimal separator, e.g. $43.123. The currency symbol should not be entered by a user when he enters a money value into a form field.
  • The DATE values have the format mm/dd/yyyy. E.g. 01/31/2011. You cannot enter a date in another format, if you are entering a date value into a form field of the DATE data type, if you DBDATE variable has value MDY4/.

Changing the default money format

These settings can be changed without the need to change the locale. To change the format of these values you should use the corresponding environment variable of your system. Environment variables are set using the command setenv on UNIX/Linux and set command on Windows.
To change the format of the money values, you should set the DBMONEY environment variable as follows:
DBMONEY [front] .|, [back]
Here front and back are optional specify the position of the currency symbol and the symbol itself. If no symbol is specified, it is by default the front dollar ($) sign. You can specify either a period or a coma as the decimal point. For example, if you set the DBMONEY value as follows, your money values will be preceded with the Euro sign and the period will be used as the decimal point (i.e. €234.98):
set DBMONEY=€.
You can also change the money and the format of numeric values (DECIMAL, FLOAT, INTEGER, etc.) using the DBFORMAT environment variable, which has the following syntax (here front and back keywords also specify the currency symbol):
DBFORMAT [front]:[thousands separator]:decimal separator:[back]

Changing the default date format

To change the default date format you can use the DBDATE environment variable. Here is its syntax:
DBDATE MD|DM   Y4|Y2   /|-|.|0
DBDATE Y4|Y2   MD|DM   /|-|.|0
Here Y2 means year in 2-digit format, Y4 – year in 4-digit format. MD – means month-day sequence, DM – day-month sequence. You can specify a slash, a hyphen or a period as a separator or you can specify zero, if you do not want any separator to be used.
For example, if you want your date values to be in format day-month-year (4-digit format) with a hyphen separator (i.e. 28-05-2012), you need to set this variable as follows: