STRFTIME(3C-POSIX) RISC/os Reference Manual STRFTIME(3C-POSIX)
NAME
strftime - formats locale-specific time
SYNOPSIS
#include <time.h>
sizet strftime(string, maximum, format, timeptr)
char *string;
sizet maximum;
char *format;
struct tm *timeptr;
DESCRIPTION
strftime provides a locale-specific way to print the current
time and date. It also allows you to rearrange the elements
of the date and time into a string.
string points to the region of memory where strftime writes
the date and time string generated. maximum is the maximum
number of characters that can be written into string.
string should point to an area of allocated memory at least
maximum + 1 bytes long.
timeptr points to a tm structure, which contains the
broken-down time. This structure must be initialized by
either localtime or gmtime.
format points to a string that contains one or more conver-
sion specifications which are used by strftime in building
its output string. Each conversion specification is intro-
duced by a percent sign (%). When the output string is
built, each conversion specification is replaced by the
appropriate time element. Characters in format that are not
part of a conversion specification are copied into the out-
put string; to write a literal percent sign, use "%%".
strftime allows the following conversion specifiers:
a The locale's abbreviated name for the day of the week.
A The locale's full name for the day of the week.
b The locale's abbreviated name for the month.
B The locale's full name for the month.
c The locale's default representation for the date and
time.
d The day of the month as an integer (01 through 31).
e The day of the month (1 through 31); single digit
Printed 1/15/91 Page 1
STRFTIME(3C-POSIX) RISC/os Reference Manual STRFTIME(3C-POSIX)
values are preceded by a blank.
H The hour as an integer (00 through 23).
I The hour as an integer (01 through 12).
j The day of the year as an integer (001 through 366).
m The month as an integer (01 through 12).
M The minute as an integer (00 through 59).
p The locale's way of indicating morning or afternoon
(e.g. in the U.S., AM or PM).
S The second as an integer (00 through 59).
U The week of the year as an integer (00 through 53);
Sunday is regarded as the first day of the week.
w The day of the week as an integer (0 through 6); Sunday
is regarded as the first day of the week.
W The day of the week as an integer (0 through 6); Monday
is regarded as the first day of the week.
x The locale's default representation of the date.
X The locale's default representation of the time.
y The year within the century (00 through 99).
Y The full year, including century.
Z The name of the locale's time zone. If no time zone
can be determined, print a null string.
RETURN VALUES
If the number of characters written into string is less than
or equal to maximum, strftime returns the number of charac-
ters written. If the number of characters to be written
exceeds maximum, strftime returns zero and the contents of
the area pointed to by string are indeterminate.
SEE ALSO
ctime(3).
Page 2 Printed 1/15/91