Return date as a string

Hello,

Does anyone have any code that will return the current date as a string as opposed to a structure of ints.

Thanks

unsigned char * getdatetime()
{
int i;
struct tm t;
unsigned char *current_time;
mktm(&t, SEC_TIMER);
sprintf(current_time,"%2d/%02d/%4d %02d:%02d:%02d
", t.tm_mon,t.tm_mday,t.tm_year + 1900, t.tm_hour,t.tm_min,t.tm_sec);

return current_time;
}

Cool! just what I was working on for 3 hours today!

The Belgian Rabbit

Just one note of warning,

This code should have “unsigned char current_time[20];”
and not “unsigned char *current_time;” otherwise it is likely to cause your app to crash.

Regards,
Peter