TODAY: Returning the Current Date

How to:

The TODAY function retrieves the current date from the operating system in the format MM/DD/YY or MM/DD/YYYY. You can remove the default embedded slashes in the date using the EDIT function. The DATE function always returns a date that is current. Therefore, if you are running an application late at night, you may want to use TODAY.

You can also retrieve the date in the format MM/DD/YY or MM/DD/YYYY using the Dialogue Manager system variable &DATE. You can retrieve the date without the slashes using the system variables &YMD, &MDY, and &DMY. The system variable &DATEfmt retrieves the date in a specified format.


Top of page

x
Syntax: How to Return the Current Date
TODAY(output_format)

where:

output_format

Alphanumeric, at least A8

Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.

The following rules apply:

  • If DATEFNS=ON and the format is A8 or A9, TODAY returns the 2-digit year.
  • If DATEFNS=ON and the format is A10 or greater, TODAY returns the 4-digit year.
  • If DATEFNS=OFF, TODAY returns the 2-digit year, regardless of the format of output_format.

Tip: TODAY is not actually a legacy date function. It is included here for your convenience. The preferred way to obtain the current date is by using the system variables &YYMD and related variables.



Example: Retrieving the Current Date

TODAY retrieves the current date and stores it in a column with the format A10.

TODAY('A10')

iWay Software