Get absolute time and date function (Date() function)

The Date() function retrieves the absolute time, in seconds, of a specified date. Use this function when comparing dates, for example, when using the Now() function. This function has one optional parameter: dateFormat. If this parameter is not defined, the function uses the default date format.

Format:

Long Date(String date, String dateFormat)

where:

date - the date for which you want to retrieve the absolute date. If not specified with dateFormat parameter, this function uses the format "yyMMdd hh:mm:ss" (for example, "100512 12:30:24")

dateFormat - optional; specifies format for the corresponding date. For example, "dd/MM/yyyy hh:mm:ss"). If this parameter is not defined, the default format ("yyMMdd hh:mm:ss") is applied.

Example:

The following example determines if the current date is earlier than 12/22/2010 and, if true, the corresponding Then expression runs:

If Now() < Date("12/22/2010")

See Also