ToDate

ToDate(number or string)

Uses the function IsDate(number or string) to check whether the number/string is right or not. If the number/string is right, the function returns a Date value between 100-1-1 and 9999-12-31. If the number/string is wrong, it returns null.

Parameters

Return value

Date value or null.

Examples

ToDate(Date a)

This function returns the specified date.

Parameter

a - A Date value.

Return value

The return value is a Date.

Example

Suppose the date is July 15, 1999, the return of the following statement is 07/15/99.

ToDate(ToDate(1999, 7, 15))

ToDate(Datetime a)

This function extracts the date portion of a specified DateTime.

Parameter

a - A TimeStamp value.

Return value

The return value is a Date value.

Example

Suppose the DateTime is July 15,1999 12:20:30, the return value of the following statement is 07/15/99.

ToDate(ToDateTime(1999, 7, 15, 12, 20, 30 ) )

ToDate(integer d)

This function converts the argument d (A milliseconds value represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT) to a data value.

Parameter

d - A Milliseconds value, a DBField value or a parameter. It should be a long integer.

Return value

The return value is a Date.

Example

The return value of the following statement is 01/02/70.

ToDate(72000000)

Note: When the milliseconds value is larger than 2³², you should use DBField or parameter instead.

ToDate(integer y, Integer m, Integer d)

This function creates a Date value from arguments y, m and d.

Parameters

Return value

The return value is a Date.

Example

The return value of the following statement is 07/15/99.

ToDate(1999, 7, 15)