Date Question

 
I've done a search through the site and the documentation, but can't find any information on how to concatenate date parts. What I'd like to do is to create a dynamic magic number based on today's date, formated as 20060712. The closest I've come is using the StrToTime function:

string var1=TimeToStr(CurTime(),TIME_DATE);

This gets me 2006.07.12, but, I don't want the periods in there because the magic number would choke.

Does anyone have suggestions? If I can't get the formatting needed, is it possible to use a CurDate() value for the magic number in an order?

Thanks.
 
Yes, you can use the CurTime() function or the LocalTime() function to create the dynamic magic number.
 
Thanks. But, I can't format it the way that I want, correct?
 

You can try to use this code:

extern int My_magic_number, myYear, myMonth, myDay;

int start()
{
// we would like to get the date formatted as 20060714
// year = 20060000 = 2006*10000
// month= 0700 = 7*100
// day = 14

myYear = TimeYear(CurTime()) * 10000;
myMonth = TimeMonth(CurTime()) * 100;
myDay = TimeDay(CurTime());

My_magic_number = myYear + myMonth + myDay;

Print("My_magic_number = ", My_magic_number);

return(0);
}

Reason: