HP C/iX Library Reference Manual (30026-90004)
Chapter 5 339
HP C/iX Library Function Descriptions
strftime
strftime
Creates a formatted time string.
Syntax
#include <time.h>
size_t strftime(char *
s
, size_t
maxsize
,
const char *
format
,
const struct tm *
timeptr
);
Parameters
s
A pointer to a character array to which the function returns a formatted
character string.
maxsize
The size of the character array.
format
A pointer to an array containing conversion specifications and ordinary
multibyte characters to be inserted the string.
timeptr
A pointer to a tm variable in broken-down time format.
Return Values
x A value of type size_t indicating the number of characters placed into the
array pointed to by
s
.
0 The resulting formatted character string is greater than
maxsize
, and
s
is
indeterminate.
Description
This function places characters into the array pointed to by
s
, which is controlled by the
string pointed to by
format
. This string consists of zero or more conversion specifications
and ordinary multibyte characters. A conversion specification consists of a % followed by a
character that determines the conversion specification's behavior.
All ordinary multibyte characters (including the terminating null character) are copied
unchanged into the array. If copying occurs between objects that overlap, the behavior is
undefined. No more than
maxsize
characters are placed into the array.
Each conversion specification is replaced by appropriate characters, as described below.
These characters are determined by the program's locale as determined by lc_time and by
the values contained in the structure pointed to by
timeptr
.
• %a is replaced by the locale's abbreviated weekday name.
• %A is replaced by the locale's full weekday name.
• %b is replaced by the locale's abbreviated month name.
• %B is replaced by the locale's full month name.