- convert datetime to string

String manipulation
(AFL 2.8)

SYNTAX DateTimeToStr( NUMBER, mode = 0 )
FUNCTION Converts number representing date/time value (for example obtained using GetCursorXPosition(), Now(), DateTime() functions) to the corresponding STRING (text).

The mode parameter defines the output mode:

  • 0 - convert both date and time portion
  • 1 - only date
  • 2 - only time.
Note that mode 2 would give you empty string when applied on chart with daily or longer interval
EXAMPLE ToolTip="X="+DateTimeToStr(GetCursorXPosition())
SEE ALSO DATETIME() function , NOW() function , StrToDateTime() function


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

More information:

Updated on-line reference