Click or drag to resize

CToDAnsi Function

X#
Convert an ANSI date string to date format.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION CToDAnsi(
	cDate AS STRING
) AS DATE
Request Example View Source

Parameters

cDate
Type: String
A string in the ANSI form yyyy.mm.dd, where yy, mm, and dd represent year, month, and day respectively.
The year, month, and day can be separated by any character other than a number.
cDate is always interpreted as an ANSI string and is not dependent on SetDateFormat() or SetDateCountry().
If the century digits are not specified, the century is determined by the rules of SetEpoch().

Return Value

Type: Date
The date value that corresponds to the numbers specified in cDate.
If cDate is not a valid ANSI date, CToDAnsi() returns a NULL_DATE.
Remarks
CToDAnsi() is a character conversion function that converts an ANSI date string to a date data type.
Examples
This examples simply applies CToDAnsi() to a string:
X#
1? CToDAnsi("84/10/23")                // 10/23/84
This example shows the effect of SetCentury():
X#
1SetCentury(TRUE)
2? CToDAnsi("2084/10/23")                // 10/23/2084
3? CToDAnsi("90$05$14")                // 05/14/1990
This example shows that CToDAnsi() is not nation-dependent:
X#
1SetDateCountry(GERMAN)
2? CToDAnsi("84/10/23")                // 23.10.1984
See Also