y = Year()%100;

Thanks a lot, Graham, that's the key, it solved the problem. Can anyone suggest 
a link with some info about "c" string formatting (all those %f, %e, %g, %100, 
etc.)

I have another question but I'll start another thread:

"How to overwrite exported CSV data file"

Lester


>Graham <[EMAIL PROTECTED]> wrote:
>
>  y = Year()%100;
> 
> ds = StrFormat( "%02.f%02.f%02.f,", y[i], m[i], d[i] ); // date string
>
> 
> On 12/06/06, Lester Vanhoff <[EMAIL PROTECTED]> wrote:
> > > Graham> If you are wanting to export the data so you can use it in 
> > > another package then use the export AFL rather than explorations.
> >
> > That's how I started but I couldn't figure out "c" code to get two digit 
> > year so I decided to try explorations first. Here is the looping code that 
> > generates the required data file (C:\Test\Ms_eod.csv) with four digit year. 
> > The question is how to change the following line to get yymmdd instead of 
> > yyyymmdd:
> >
> > ds = StrFormat( "%4.f%02.f%02.f,", y[i], m[i], d[i] );
> >
> > I tried these two options but both still give four digit year:
> >
> > ds = StrFormat( "%02.f%02.f%02.f,", y[i], m[i], d[i] );
> > ds = StrFormat( "%2.f%02.f%02.f,", y[i], m[i], d[i] );
> >
> > Here is the full code:
> >
> > /****START****/
> >
> > folder = "C:\\Test";
> > fmkdir( folder ); // this automatically creates the directory
> >
> > fh = fopen( folder + "\\" + "Ms_eod.csv", "a");
> >
> > if (fh)
> > {
> >   t = Name();
> >   p = "D";
> >   y = Year();
> >   m = Month();
> >   d = Day();
> > for( i = 0; i < BarCount; i++ ) // loop
> >   {
> >   fputs( t + "," , fh );
> >   fputs( p + "," , fh );
> >   ds = StrFormat( "%4.f%02.f%02.f,", y[i], m[i], d[i] ); // date string
> >   fputs( ds, fh );
> >   qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f, %.0f\n", O[i], H[i], L[i], 
> > C[i], V[i], OI[i] ); // quote string
> >   fputs( qs, fh );
> >   }
> > fclose( fh );
> > }
> > Buy = 0; // link to "scan" button
> >
> > /****END****/







------------------------ Yahoo! Groups Sponsor --------------------~--> 
You can search right from your browser? It's easy and it's free.  See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

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

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

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



Reply via email to