Click or drag to resize

CToT Function

X#
-- todo --
Returns a DateTime value from a character expression.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION CToT(
	cCharacterExpression
) AS USUAL CLIPPER
Request Example View Source

Parameters

cCharacterExpression (Optional)
Type: Usual
Specifies the character expression from which a DateTime value is returned.

Return Value

Type: Usual
DateTime data type. CToT( ) returns a DateTime value from a character expression.
Remarks
Note Note
CToT() can create ambiguous DateTime values and generates a compilation error when Set STRICTDATE is set to 2. To create nonambiguous Date values, use the DATETIME( ) function instead.
X# supports the native SQL Datatypes Datetime and Smalldatetime, which are returned in 24 hour format in SQL XML.
Note Note
The CToT() function does not address the 19 different ways that T-SQL Convert() function returns datetime and smalldatetime values.
To convert date formats from Access, SQL Server, Visual Studio, and XML, you must call the appropriate Set DATE setting to interpret DateTime strings properly. However, if an uppercase T is in the XML date string, X# overrides the current date setting by internally calling Set DATE YMD and restores the current date setting when exiting CToT( ).
Note Note
CToT( ) resolves these dates to the limits of precision of the X# DateTime data type. Therefore, precision can be lost when using CToT( ) with certain formats. The X# DateTime data type does not support milliseconds or time zones.
CToT( ) respects the setting of the Set CENTURY command. For more information, see Set CENTURY Command.

The following examples show how CToT( ) handles DateTime values from different sources. In all examples, CToT( ) converts the DateTime values correctly without needing to call Set DATE YMD. Access 2000 XML date format
X#
1* 2000-10-24T13:30:00 (24-hour format is exported from Access,
2* whether original was in 12- or 24-hour format)
3? CToT("2000-10-24T13:30:00")
SQL Server 2000 XML date format
X#
1? CToT("2000-10-24T20:47:58.170")   // datetime (24-hour format)
2? CToT("2000-10-24T21:11:00")         // Small DT (24-hour format)
3? CToT("2000-10-03T02:02:02")
Visual Studio XML
X#
1? CToT("2002-10-05T04:04:04.0000000-07:00")
Simple Object Access Protocol (SOAP)
X#
1? CToT("2001-09-14T07:00:00Z")
See Also