Share via


CTOT( ) Function

Returns a DateTime value from a character expression.

CTOT(cCharacterExpression)

Return Values

DateTime

Parameters

  • cCharacterExpression
    Specifies the character expression from which a DateTime value is returned.

Remarks

Note that CTOT( ) can create ambiguous DateTime values, and generates a compilation error when SET STRICTDATE is set to 2. Use DATETIME( ) instead to create nonambiguous Date values. For more information about ambiguous dates, see Year 2000 Date Support.

This version of Visual FoxPro supports the native SQL Datatypes Datetime and Smalldatetime which are returned in 24 hour format in SQL XML.

Note   This update to the CTOT( ) function does not address the 19 different ways that T-SQL Convert( ) function returns datetime and smalldatetime values.

Examples

The CTOT( ) function handles XML-style dates as returned by SQL 2000 XML queries and other applications that import or export data in XML formats as in the following examples.

Access 2000 XML Date Format:

   *2000-10-24T13:30:00       (24-hour exported from Access, whether
   *original was in 12- or 24-hour format)
   ? CTOT("2000-10-24T13:30:00")

SQL 2000 XML Date Format:

   2000-10-24T20:47:58.170      && datetime (24 -hour)
   2000-10-24T21:11:00         && Small DT (24-hour)

See Also

DATETIME( ) | SET STRICTDATE | Year 2000 Date Support