asctime() returns a static char *, which will change with subsequent calls to time functions; this makes a local copy.Code:#include <time.h> int main(int argc, char *argv[]) { time_t lt; struct tm t, *tmptr; char tmp[26]={'\0'}; lt=time(NULL); tmptr=localtime( & lt ); strcpy(tmp,asctime(tmptr)); printf("%s\n",asctime(tmptr)); printf("%s\n",tmp); return 0; }