xHarbour Reference Documentation > Function Reference |
Converts a character string into a DateTime value
CtoT( <cDateTimeString> ) --> dDateTime
The function returns the converted DateTime value. If <cDateTimeString> is not a valid DateTime string, an empty DateTime value is returned.
The conversion function CtoT() is used to create DateTime values from string literals formatted as a DateTime. Such literals are returned from function TtoC(). Formatting of the string literal must comply with the current SET DATE format. That is, digits for day, month and year in <cDateString> are interpreted according to the sequence of the letters dd, mm and yy in the SET DATE format string.
The Time part of the DateTime value must be formatted as "hh:mm:ss.ccc". (refer to SET TIME). If the Time part is omitted from <cDateTimeString>, the Time part in the return value is set to 00:00:00.
The conversion rules of SET EPOCH apply for the year when it is not specified with four digits.
Use function StoT() to convert a string to a DateTime value independently of SET DATE.
See also: | CtoD(), DateTime(), SET CENTURY, SET DATE, SET TIME, SET EPOCH, StoT(), TtoC(), TtoS() |
Category: | Conversion functions , Date and time , xHarbour extensions |
Source: | rtl\dateshb.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
http://www.xHarbour.com