Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ctime, ctime64 - convert date and time to string

&pagelevel(4)&pagelevel

Syntax

#include <time.h>

char *ctime(const time_t *clock);
char *ctime64(const time64_t *clock); 

Description

ctime() converts the time specified by clock to a local time specification. The function
returns a pointer to a string consisting of 26 characters (see return value).

clock is represented as the time in seconds since 00:00:00 UTC (Universal Time
Coordinated; January 1, 1970).

A call to ctime() has the same effect as asctime(localtime(clock)).

Calling ctime64() has the same effect as asctime64(localtime(clock)), the latest and
earliest displayable dates being 31.12.9999 23:59:59 hrs. local time and 1.1.1900
00:00:00 hrs.

ctime() is not thread-safe. Use the reentrant function ctime_r() when needed.

Return val.

Pointer to a string


if successful. The resulting string has a length of 26 (incl. the null byte) and
is formatted as a date and time specification in the form:

weekday month day hrs:min:sec year

e.g. Thu Jun 14 15:20:54 2018\n\0

EOVEFLOW

In case of an error. errno is set to indicate the error.

Notes

The asctime(), ctime(), ctime64(), gmtime(), gmtime64(), localtime() and
localtime64() functions write their result into the same internal C data area. This means
that each of these function calls overwrites the previous result of any of the other functions.

See also

altzone, asctime(), ctime_r(), daylight, gmtime(), localtime(), timezone,
tzname, tzset(), time.h.