Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
strftime
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The strftime function formats the tm time value in <timeptr>
according to the supplied format argument, and stores the result
in the buffer <string>. At most, <maxsize> characters are placed
in the string.
The format consists of one or more of the codes; as in printf, the
formatting codes are preceded by a % sign. Characters that do not
begin with a % sign are copied unchanged to <string>. The LC_TIME
category of the current locale affects the output formatting of
strftime.
The formatting codes for strftime are listed below:
Format Description
%a Abbreviated weekday name
%A Full weekday name
%b Abbreviated month name
%B Full month name
%c Date and time representation appropriate for the locale
%d Day of the month as a decimal number (01-31)
%H Hour in 24-hour format (00-23)
%I Hour in 12-hour format (01-12)
%j Day of the year as a decimal number (001-366)
%m Month as a decimal number (01-12)
%M Minute as a decimal number (00-59)
%p Current locale's AM/PM indicator for a 12-hour clock
%S Second as a decimal number (00-61)
%U Week of the year as a decimal number; Sunday is taken
as the first day of the week (00-53)
%w Weekday as a decimal number (0-6; Sunday is 0)
%W Week of the year as a decimal number; Monday is taken
as the first day of the week (00-53)
%x Date representation for current locale
%X Time representation for current locale
%y Year without the century as a decimal number (00-99)
%Y Year with the century as a decimal number
%z Time zone name or abbreviation; no characters if time
zone is unknown
%% Percent sign
Return Value
The strftime function returns the number of characters placed in
<string> if the total number of resulting characters (including
the terminating null) is not more than <maxsize>.
Otherwise, strftime returns 0, and the contents of the string are
indeterminate.
-♦-