Share via


TTOD( ) Function

Returns a Date value from a DateTime expression.

TTOD(tExpression)

Parameters

  • tExpression
    Specifies a date and time expression from which TTOD( ) returns a Date value. tExpression must evaluate to a valid DateTime. If tExpression contains only a time, Visual FoxPro adds the default date of 12/30/1899 to tExpression and returns this default date.

Return Value

Date

Example

The following example creates a Datetime type variable named gtDtime. TYPE( ) displays T, indicating the variable is a Datetime type. TTOD( ) is used to convert the variable to a date type, and TYPE( ) now displays D, indicating the variable is a date type after the conversion.

STORE DATETIME( ) TO gtDtime  && Creates a Datetime type memory variable
CLEAR
? "gtDtime is type: "  
?? TYPE('gtDtime')  && Displays T, Datetime type value

gtDtime = TTOD(gtDtime)     &&  Converts gtDtime to a date value
? "gtDtime is now type: "  
?? TYPE('gtDtime')  && Displays D, character type value

See Also

Reference

DATE( ) Function
DATETIME( ) Function
HOUR( ) Function
MINUTE( ) Function
SEC( ) Function
SECONDS( ) Function
SET CENTURY Command
SET SECONDS Command
TIME( ) Function
TTOC( ) Function

Other Resources

Functions
Language Reference (Visual FoxPro)