Definition | #include <time.h> char *ctime(const time_t *sec_ptr);
Negative values are interpreted as seconds before the reference date. The earliest The latest date which can be displayed with | |
Return val. | Pointer to the 26-character string generated. | |
The resulting string has a length of 26 (incl. the terminating null byte \0) and | ||
NULL | In the event of an error | |
Notes |
Time specifications are based on the 24-hour clock. |
Example | The following program converts an input value to local time and outputs the result in the #include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { time_t sec; sec = time((time_t *)0); printf("%s",ctime(&sec)); return 0; } |
See also | asctime, gmtime, gmtime64, localtime, localtime64, mktime, mktime64, time, time64 |