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

Re: [amibroker] How To Get Two Digit Year In Exploration



PureBytes Links

Trading Reference Links

Note that DateTime() returns an array which you are treating as a string. 
Recode with Year(), Month(), and Day() and then you can manipulate to 
produce the output that you want.

----- Original Message ----- 
From: "Lester Vanhoff" <ebsn247lsm@xxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, June 10, 2006 4:19 AM
Subject: [amibroker] How To Get Two Digit Year In Exploration


>
> 1) The following exploration works ok:
>
> Filter = 1;
> SetOption("NoDefaultColumns", True);
> AddTextColumn(Name(), "Ticker");
> AddColumn( DateTime(), "Date&Time", formatDateTime );
> AddColumn( Close, "Close", 1.4 );
> AddColumn( Volume, "Volume", 1.0 );
>
> 2) Now if you try to get two-digit year instead of four-digit year the 
> formula returns an error (the date format on my computer is set to 
> yyyy-mm-dd):
>
> /***START***/
>
> Filter = 1;
>
> yy = StrMid(DateTime(),2,2); //start=char#2 (zero based), length=2 char
> mm = StrMid(DateTime(),5,2);
> dd = StrMid(DateTime(),8,2);
>
> SetOption("NoDefaultColumns", True);
> AddTextColumn(Name(), "Ticker");
> AddColumn( DateTime(), "Date&Time", formatDateTime );
> AddTextColumn(yy+mm+dd, "yymmdd");
>
> AddColumn( Close, "Close", 1.4 );
> AddColumn( Volume, "Volume", 1.0 );
>
> /***END***/
>
> The solution might be to place DateTimeToStr() or StrToDateTime() 
> somewhere there. As a non-programmer I still can't get the feel for all 
> those strings, numbers, arrays, etc.
>
>
>
>
>
>
>
> 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 other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.8.3/360 - Release Date: 06/09/06
>
>