Programming Reference/Librarys
Question & Answer
Q&A is closed
The ctime() function shall convert the time pointed to by clock, representing time in seconds since the Epoch, to local time in the form of a string. It shall be equivalent to
asctime(localtime(clock))
1970-01-01 00:00:00 +0000 (UTC).
The ctime() function shall return the pointer returned by asctime() with that broken-down time as an argument.
Upon successful completion, ctime_r() shall return a pointer to the string pointed to by buf. When an error is encountered, a null pointer shall be returned.
/* * ctime example code * http://code-reference.com/c/time.h/ctime */ #include <stdio.h> #include <time.h> int main(void) { time_t time_format; time(&time_format); printf("%s\n", ctime(&time_format)); return 0; }
Mon Apr 23 18:24:18 2012