CDATE

Purpose

Returns an expression that has been converted to a Variant of subtype Date.

Syntax

CDATE(date)

Description

CDate recognizes date literals and time literals as well as some numbers that fall within the range of acceptable dates. When converting a number to a date, the whole number portion is converted to a date. Any fractional part of the number is converted to a time of day, starting at midnight.

CDate recognizes date formats according to the locale setting of your system. The correct order of day, month, and year might not be determined if it is provided in a format other than one of the recognized date settings. Additionally, a long date format is not recognized if it also contains the day-of-the-week string.

Reference to a date field from a product table can be made by using the syntax:

CDATE({<table>\<fieldname>})

Example

To compare a Due Date and a specific date (e.g. 2002/02/02):

If CDATE({LA\Due Date}) < CDATE("2002/02/02") Then
Result = 0
ElseResult = 1
End If
Function Result
CDATE("1 January 2016") 01/01/2016
CDATE("2002-02-02") 02/02/2002
CDATE({LA\Due Date}) 03/02/2002

The format of the date returned by the function will depend on your system locale.