Converts a tm time structure to a character string.
char * asctime( TM * timeptr )
[input] timeptr, a pointer to TM structure
a pointer to the character string result
EX1
void asctime_ex1() { struct tm *newtime; time_t aclock; time( &aclock ); // Get time in seconds newtime = localtime( &aclock ); // Convert time to struct // tm form // Print local time as a string printf( "The current date and time are: %s", asctime( newtime ) ); }
The timeptr value is usually obtained from a call to localtime, which returns a pointer to a tm structure, defined in time.h. It can be seen more at See Also.
time, localtime, tm
origin.h