ctime function returns a time in string
Syntax
C ctime function has the following syntax.
char *ctime(const time_t *time);
Header
C ctime function
is from header file time.h
.
Description
C ctime function returns a time in string, whose form is
day month year hours:minutes:seconds year \n\0
Example
Use C ctime function to get time in string.
#include <time.h>
#include <stdio.h>
/*www. ja v a 2s . c o m*/
int main(void)
{
time_t lt;
lt = time(NULL);
printf(ctime(<));
return 0;
}
The code above generates the following result.