Click or drag to resize

CToDt Function

X#
Convert a Date string to DateTime.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.21
Syntax
 FUNCTION CToDt(
	cDate AS STRING,
	cDateFormat AS STRING
) AS DateTime
Request Example View Source

Parameters

cDate
Type: String
A string of numbers representing the month, day, and year, separated by any character other than a number. The month, day, and year digits must be in the format set by SetDateFormat() or SetDateCountry(). If the century digits are not specified, the century is determined by the rules of SetEpoch().
cDateFormat
Type: String
A string representating the date format to use when converting the string to a date. Should consist of D, M and Y characters and separators.

Return Value

Type: DateTime
The DateTime value that corresponds to the numbers specified in cDate. If cDate is not a valid date, CToDt() returns a DateTime.MinValue.
See Also