How do I format a time_t structure to something like this year-month-day h:m:s,
I have already tried using ctime:
time_t t = time((time_t*) NULL);
char *t_format = ctime(&t);
but it doesn’t give me the desired results
example :
2011-11-10 10:25:03. What I need is a string containing the result so I can write it to a file. Thanks
Use strftime from
time.hlike so: