The function asctime() converts the time in the struct ptr to a character string of the format: Day Month Date Hour:Minute:Second Year\n\0
/* * asctime example code * http://code-reference.com/c/time.h/asctime */ #include <stdio.h> #include <time.h> int main ( void ) { time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); printf ( "Current Date is: %s", asctime (timeinfo) ); return 0; }
Current Date is: Sat Apr 21 13:13:46 2012