The easiest way is to use the following:
time_t tm;
struct tm *xtm;
char msg[64];
t = time (NULL);
tm = localtime (&t);
strcpy (msg, asctime (tm));
DebugPrintf ("%s", msg);
It produces this output:
Wed Apr 20 14:50:10 2005
In case you want a different format for the output string, you must use strftime () which permits you to define your own format.