[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] DateNum() format to conventional format



PureBytes Links

Trading Reference Links

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);
}

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



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/