Name

ctime function — Converts a time to a string

Synopsis

char* ctime(const time_t* timeptr)

The ctime function converts the date and time pointed to by timeptr to local time and formats the time as a string. It is equivalent to:

std::asctime(std::localtime(timeptr));

The text is written to a static buffer, and a pointer to that buffer is returned. Subsequent calls can overwrite the buffer contents. The static buffer can be shared with asctime.

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.