C Language: ctime function
(Convert Date and Time to String)
In the C Programming Language, the ctime function converts a calendar time (pointed to by timer) and returns a pointer to a string describing the local time equivalent.
Syntax
The syntax for the ctime function in the C Language is:
char *ctime(const time_t *timer);
Parameters or Arguments
- timer
- A pointer to an object of type time_t that contains a time value to convert.
Returns
The ctime function returns a pointer to a string describing a local time pointed to by timer. It is equivalent to the following asctime function call:
asctime(localtime(timer));
Required Header
In the C Language, the required header for the ctime function is:
#include <time.h>
Applies To
In the C Language, the ctime function can be used in the following versions:
- ANSI/ISO 9899-1990
Similar Functions
Other C functions that are similar to the ctime function:
Advertisements