Functions


Visual FoxPro 9.0 SP2
CTOD( ) Function

Converts a character expression to a date expression.

CTOD(cExpression)

Parameters

cExpression

Specifies a character expression.

Return Value

Date data type. CTOD( ) returns a Date value.

Remarks

NoteNote

CTOD() can create ambiguous Date values and generates a compilation error when SET STRICTDATE is set to 2. To create unambiguous Date values, use the DATE( ) function.

Example

The following example uses CTOD( ) to convert Character data to a Date and then performs simple date related actions.

SET CENTURY ON               && Shows the century value.
cDate="01/01/2003"
?CTOD(cDate)               && Returns 01/01/2003 as Date.
?GOMONTH(CTOD(cDate),12)   && Returns 01/01/2004.
?CTOD(cDate)+100            && Returns 04/11/2003.
See Also

Reference

DATE( ) Function
SET STRICTDATE Command
TTOD( ) Function

Other Resources

Functions
Language Reference (Visual FoxPro)

Tags :


Page view tracker