- convert string to datetime

String manipulation
(AmiBroker 4.80)

SYNTAX StrToDateTime( ''string'' )
FUNCTION Converts string representing date/time value to the corresponding DateTime number (that can be later compared to output of DateTime() function for example).

This function has shorter synonym: _DT function.

VERSION 5.27 and above: It is important to understand that DateTime is not a simple number but rather bitset and two datetime values can only be reliably compared for equlity or inequality using == or != operators. Any other comparisions (less than/greater then) using normal operators > < can lead to wrong results, therefore to compare two datetime numbers you should use DateTimeDiff( arg1, arg2 ) which will return positive values if arg1 > arg2 and negative values if arg1 < arg2.

EXAMPLE Buy = DateTime() == StrToDateTime("2005-Mar-05");  
SEE ALSO DATETIME() function , DateTimeToStr() function , _DT() function


The StrToDateTime function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.