DateTimeToStr on 6.0002 Vs on 6.2


As DateTimeFormat() is 6.20+ specific and as my older backup laptop still running older Amibroker version 6.0002, I wrote custom implementation for DateTimeFormat().

Within this, use of DateTimeStr() as shown below is giving me error of "too many arguments" (second param not accepted).

bar_dates = DateTime();

//3 => Return ISO format of Date
sTemp = DateTimeStr(bar_dates[0], 3)

I read the docs for DateTimeStr(), which says it is in Amibroker 4.80+ (so must be valid in 6.0002) and mentions use of second argument.

Hence, I am clueless what is being done wrong at my end. Note, code works perfect in my 6.2.x Amibroker on my main machine.

Thanks a lot for your time.


second parameter mode was added in AB version 6.06

CHANGES FOR VERSION 6.06.0 (as compared to 6.05.0)
4. AFL: extra parameter for DateTimeToStr function mode (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

and others were added in AB 6.15

CHANGES FOR VERSION 6.15.0 (as compared to 6.14.0)
4. AFL: new modes added to DateTimeToStr() that use ISO regardless of regional settings mode = 3 (iso date and time YYYY-MM-DD HH:MM:SS) HH:MM:SS part is only included for non-EOD records, 4 (iso date only YYYY-MM-DD), 5 (iso time only HH:MM:SS)

Also help pf AB 6.00 clearly mentions just single argument.


1 Like

OK, great, neat inputs

So now, if I use DateTimeStr() with just bar-dates, I will not get (exact) ISO format (on 6.00), which I desire.

Hence would go ahead to use arrays Day(). . .to Second() before constructing ISO format date-time literal. This will require code for padding leading zeros for single digit values.

Alternately I will process string returned by DateTimeStr() to make ISO format.

#1: Is there any simpler way to do this (in Amibroker 6.00)? Thanks. I mean counterpart for DateTimeFormat() of 6.2 for returning ISO date.

#2: And does DateTimeStr() look into Control Panel setting before returning date format (in 6.00, which carries no second param)?

Many thanks for your time


This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.