The C Programming Language, Ansi C
if it cannot be represented.
The next four functions return pointers to static objects that may be
overwritten by other calls.
char *asctime(const struct tm *tp)
asctime
*tp into a string
of the form
Sun Jan 3 15:14:13 1988n0
char *ctime(const time_t *tp)
ctime
converts the calendar time
*tp
to local time; it is
equivalent to
asctime(localtime(tp))
struct tm *gmtime(const time_t *tp)
gmtime
converts the calendar time
*tp
into Coordinated
Universal Time (UTC). It returns
NULL
if UTC is not available. The
name
gmtime
has historical significance.
struct tm *localtime(const time_t *tp)
localtime
converts the calendar time
*tp
into local time.
size_t strftime(char *s, size_t smax, const char *fmt, const struct tm *tp)
strftime
formats date and time information from
*tp
into
s
according to
fmt
, which is analogous to a
printf
format. Ordinary
characters (including the terminating
'0'
) are copied into
s
. Each %c is replaced as described below, using values appropriate for
the local environment. No more than
smax
characters are placed into
s
.
strftime
returns the number of characters, excluding the
'0'
, or zero if more than
smax
characters were produced.
%a
abbreviated weekday name.
%A
full weekday name.
%b
abbreviated month name.
%B
full month name.
%c
local date and time representation.
%d
day of the month (
01-31
).
%H
hour (24-hour clock)
(00-23)
.
%I
hour (12-hour clock)
(01-12)
.
%j
day of the year
(001-366)
.
%m
month
(01-12)
.
%M
minute
(00-59)
.
%p
local equivalent of AM or PM.
%S
second
(00-61)
.
%U
week number of the year (Sunday as 1st day of week)
(00-53)
.
%w
weekday (
0-6
, Sunday is 0).
%W
week number of the year (Monday as 1st day of week)
(00-53)
.
%x
local date representation.
%X
local time representation.
%y
year without century
(00-99)
.
%Y
year with century.
%Z
time zone name, if any.
%%
%
The header
limits.h>
defines constants for the sizes of
integral types. The values below are acceptable minimum magnitudes; larger
values may be used.
CHAR_BIT
8
bits in a
char
CHAR_MAX
UCHAR_MAX