#include <time.h> char *ctime(const time_t *timep);
ctime
converts a time_t
value (as returned by the time
function) to a printable character string and returns the address of
the first character of the string. The string has the form
wkd mon dd hh:mm:ss yyyy\n
, for example,
Thu Oct 10 16:49:07 1985\n
. The length of the string is always 25.
(The day of the month is padded on the left with blanks to two characters if
necessary; the hours, minutes, and seconds are padded with 0s.)
ctime
is affected by time zone information
contained in the TZ environment variable.
ctime
returns a pointer to the formatted local date and time.
ctime
may reference static
storage,
which may be overwritten by the next call to asctime
or ctime
.
ctime(timep)
is implemented as asctime(localtime(timep))
.
#include <time.h> #include <stdio.h> main () { time_t timeval; time(&timeval); printf("The current time and date are: %s", ctime(&timeval)); }
asctime
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.