Here the code:
It almost works, but the output is a little bit stange. I got the year month and day but in the end it just outputs some random stuff, for example 2007 06 19&\220wF@\340Code:#include <stdio.h> #include <time.h> int main (void) { time_t ctime = time(NULL); char c [10]; const char format[] ="%Y %m %d"; struct tm *today = localtime(&ctime); strftime(c, sizeof(c), format, today); puts(c); return 0; }
What I'm doing wrong?