The amibroker function datenum()
returns an array with dates represented in numbers. How to convert this array into the string equivalent?
I have this function below which almost accomplishes this task except that only year 2000 and after is supported. How to fix it such that dates before year 2000 can be supported?
/*
Function changes DateNum ex:1040928 en String ddmmyyyy ex:28/09/2004 ( only > 2000 year )
*/
function sDate( nDate )
{
string = StrFormat( "%0.9g", nDate );
//extract string part
aa = StrLeft( string, 3 );
mm = StrMid( string, 3, 2 );
dd = StrRight( string, 2 );
//transform year en num
aa1 = StrToNum( aa ) + 1900; // ONLY CORRECT AFTER 2000
yyyy = NumToStr( aa1, 1, False );
result = yyyy + "-" + mm + "-" + dd;
return result;
}