strftime
Syntax
Format
Time
#include
<time.h>
size_t
*strftime(s,
maxsize,
format,
timeptr)
char
*s,
*format;
size-t
maxsize;
struct
tm
*timeptr;
Defined
in
strftime.
c in
rts.
src
Description
The strftime function formats a time (pointed
to
by
timeptr)
according
to
a
format
string, and returns the formatted time in the string
s.
Up
to
maxsize
characters can be written
to
s.
The
format
parameter is a string
of
characters that tells the strftime
function
how
to
format the time; the
following
list shows the valid characters and describes
what
each character
expands to.
6-72
Character
is
replaced
by
...
%a
the locale's abbreviated weekday name
%A
the locale's full weekday name
%b
the locale's abbreviated
month
name
%8
the locale's full month name
%c
the locale's appropriate date and time representation
%d
the day
of
the month
as
a decimal number
(0-31)
%H
the hour
(24-
hour clock)
as
a decimal number
(00-23)
%1
the hour
(12-hour
clock)
as
a decimal number
(01-12)
%j
the day
of
the year
as
a decimal number
(001-366)
%m
the month
as
a decimal number
(01-12)
%M
the minute
as
a decimal number
(00-59)
%p
the locale's equivalent
of
either
AM
or
PM
%5
the second
as
a decimal number
(00-50)
%U
the week number
of
the year (Sunday
is
the first day
of
the week)
%x
%X
%y
%y
%Z
%%
as
a decimal number
(00-52)
the locale's appropriate date representation
the
locale's appropriate time representation
the year
without
century
as
a decimal number
(00-99)
the year
with
century
as
a decimal number
the time zone name, or
by
no characters
if
no time zone exists
%
For more information about the functions and types that the
time.
h
header declares,
see
Section 6.1.10 on page
6-7.