Date

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 3


Date (dateString) Date

ParameterTypeDescription
dateStringStringString representing the date to be returned
Function resultDateDate

Description

The Date command evaluates dateString and returns a date.

The dateString parameter must follow the normal rules for the date format.

In the US version of 4D, the date must be in the order MM/DD/YY (month, day, year). The month and day can be one or two digits. The year can be two or four digits. If the year is two digits, then Date adds 19 to the beginning of the year, unless you have change this default using the command SET DEFAULT CENTURY. The following characters are valid date separators: slash (/), space, period (.), and comma (,).

Date does not check whether or not dateString is a valid date. If an invalid date (such as "13/35/94") is passed, Date will return the invalid date. However, if dateString could not possibly be interpreted as a date (for example, "aa/12/94"), the null date value (!00/00/00!) is returned.

It is your responsibility to verify that dateString is a valid date.

Examples

1. The following example uses a request box to prompt the user for a date. The string entered by the user is converted to a date and stored in the reqDate variable:

   vdRequestedDate:=Date(Request ("Please enter the date:";String(Current date)))
   If (OK=1)
      ` Do something with the date now stored in vdRequestedDate
   End if

2. The following example returns the string "12/12/94" as a date:

   vdDate:=Date("12/12/94")

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next