My exploration
shows a date 
in DateNum() format
[eg. 990101 or 1010101].

Is there a way to have it recorded in conventional format
[eg. mmddyyyy] ?

In the library there are formulas to convert,
which I would like to use,
[See library formula example below]
but how are the formula results
used in an exploration?

Eg. 
How would I use the library  formula
to call out the 'date value' I want
using :

Dt= ValueWhen( H == Highest(H), 'date value' ?); 

AddColumn(Dt,"Dt",1.0);

That is, 
what is the method to make use of the 'return string' 
in an exploration ?

================================
FORMULA:

//JD Fagan
//2005-11-16
Here's a version that works without regard to if its before or after
year 2000. 
Will work for the 1990's too which is nice for those with large databases.
*/

//Transform DateNum (e.g., 1040928 or 921114) 
//to String mmddyyyy (e.g., 09/28/2004 or 11/14/1992)

//function DateToStr(DateNum) {

//if you want string without separators you have to specify this in your
//NumToStr call http://www.amibroker.com/f?numtostr
//string=NumToStr(SelectedValue(nDate),1,False);

//You can use StrFormat for more control
http://www.amibroker.com/f?strformat
//string = StrFormat("%7.07g", DateNum);

//extract string part
yy = StrLeft(string, 3);
mm = StrMid(string, 3, 2);
dd = StrRight(string, 2);

//transform year
yy = StrToNum(yy) + 1900; //CORRECT BEFORE AND AFTER 2000

//return string
return mm + "/" + dd + "/" + NumToStr(yy, 1, False);
}

================================

Reply via email to