CPB Mailing List

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

It's time to use Time()



I'm having some poblems with the C++ Time() function.  The following
lines contain a simple code that displays the date but only the old C
method works:

// Here starts the C++ method
Label1->Caption = Time().FormatString("mmdd");
// displays "1230"  Why ???

// Here is the C method
time_t now;
struct tm *ptr;
time(&now);
ptr = localtime(&now);
char buf1[80];
strftime(buf1, 80, "%m%d", ptr);
Label2->Caption = buf1;
// displays "0227"

Why the Time() function doesn't work and the C method works ???
Thanks
P.S. I checked my Windows clock :)


W Komornicki's Home Page | Main Index | Thread Index