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
struct tm *newtime;
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