STRFTIME(3,L) AIX Technical Reference STRFTIME(3,L) ------------------------------------------------------------------------------- strftime PURPOSE Places characters into an array. SYNTAX #include <time.h> size_t strftime (s, maxsize, format, timeptr) char *s; size_t maxsize; const char *format; const struct tm *timeptr; DESCRIPTION The strftime subroutine places characters into the array pointed to by s as controlled by the string pointed to by format. The format will be a multibyte character sequence, beginning and ending in its initial shift state. The format string consists of zero or more conversion specifiers and ordinary multibyte characters. A conversion specifier consists of a percent sign (%) followed by a character that determines the behavior of the conversion specifier. All ordinary multibyte characters (including the terminating NULL character) are copied unchanged into the array. If copying takes place between objects that overlap, the behavior is undefined. No more than maxsize characters are placed into the array. Each conversion specifier is replaced by appropriate characters as described by the LC_TIME category of the current locale and by the values contained in the structure pointed to by timeptr. Processed November 7, 1990 STRFTIME(3,L) 1
STRFTIME(3,L) AIX Technical Reference STRFTIME(3,L) +------------------------------------------------+ | strftime parameters and their action | +------------------------------------------------+ |Flag Action | +----+-------------------------------------------+ |%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. | +----+-------------------------------------------+ |%c | is replaced by the locale's appropriate | | | date and time conversion. | +----+-------------------------------------------+ |%d | is replaced by the day of month as a | | | decimal number (01-31.) | +----+-------------------------------------------+ |%D | is replaced by the date (%m/%d/%y). | +----+-------------------------------------------+ |%h | is replaced by the locale's abbreviated | | | month name. | +----+-------------------------------------------+ |%H | is replaced by the hour (24-hour clock) | | | as a decimal number (00-23). | +----+-------------------------------------------+ |%I | is replaced by the hour (12-hour clock) | | | as a decimal number (01-12). | +----+-------------------------------------------+ |%j | is replaced by the day of the year as a | | | decimal number (001-366). | +----+-------------------------------------------+ |%m | is replaced by the month as a decimal | | | number (01-12). | +----+-------------------------------------------+ |%M | is replaced by the minute as a decimal | | | number (00-59). | +----+-------------------------------------------+ |%n | is replaced by a newline character. | +----+-------------------------------------------+ |%p | is replaced by the locale's equivalent of | | | the AM/PM designations associated with a | | | 12-hour clock. | +----+-------------------------------------------+ Processed November 7, 1990 STRFTIME(3,L) 2
STRFTIME(3,L) AIX Technical Reference STRFTIME(3,L) +------------------------------------------------+ | strftime parameters and their action | +------------------------------------------------+ |Flag Action | +----+-------------------------------------------+ |%r | is replaced by the time in a.m./p.m. | | | notation according to British/US | | | conventions (%I:%M:%S\[AM|PM]). | +----+-------------------------------------------+ |%S | is replaced by the second as a decimal | | | number (00-61). | +----+-------------------------------------------+ |%t | is replaced by a tab character. | +----+-------------------------------------------+ |%T | is replaced by the time (%H:%M:%S:). | +----+-------------------------------------------+ |%U | is replaced by the week number of the | | | year (Sunday as the first day of week 1) | | | as a decimal number (00-53). | +----+-------------------------------------------+ |%w | is replaced by the weekday as decimal | | | number [0(Sunday)-6] | +----+-------------------------------------------+ |%W | is replaced by the week number of the | | | year (Monday as the first day of week 1) | | | as a decimal number (00-53). | +----+-------------------------------------------+ |%x | is replaced by the locale's appropriate | | | date representation. | +----+-------------------------------------------+ |%X | is replaced by the locale's appropriate | | | time representation. | +----+-------------------------------------------+ |%y | is replaced by the year without century | | | as a decimal number (00-99). | +----+-------------------------------------------+ |%Y | is replaced by the year with century as a | | | decimal number. | +----+-------------------------------------------+ |%z | is replaced by the time zone name or | | | abbreviation, or by no characters if no | | | time zone is determinable. | +----+-------------------------------------------+ |%% | is replaced by %. | +----+-------------------------------------------+ If a conversion specifier is not one of the above, a % is copied. Processed November 7, 1990 STRFTIME(3,L) 3
STRFTIME(3,L) AIX Technical Reference STRFTIME(3,L) +---------------------------------------------------------------------------+ | strftime parameters and their action | +----+-----------------+----------------------------------------------------+ |Flag| SETLOCALE token | C locale default | | | name | | +----+-----------------+----------------------------------------------------+ | %a | MBSDAY | Sun:Mon:Tue:Wed:Thu:Fri:Sat | +----+-----------------+----------------------------------------------------+ | %A | MBLDAY | Sunday:Monday:Tuesday:Wednesday:... | +----+-----------------+----------------------------------------------------+ | %b | MBSMONTH | Jan:Feb:Mar:Apr:May:Jun:Jul:Aug:... | +----+-----------------+----------------------------------------------------+ | %B | MBLMONTH | January:February:March:April:May:June: | | %c | MBLDATIM | %a %b %d %H:%M:%S %Z %Y | +----+-----------------+----------------------------------------------------+ | %p | MBAM_STR | a.m. | | | MBPM_STR | p.m. | +----+-----------------+----------------------------------------------------+ | %x | MBLDATE | %b %d %Y | +----+-----------------+----------------------------------------------------+ | %X | MBTIME | %H:%M:%S | +----+-----------------+----------------------------------------------------+ RETURN VALUE If the total number of resulting characters including the terminating NULL character is not more than that of maxsize, the strftime function returns the number of characters placed into the array pointed to by s, not including the terminating null character. Otherwise, zero is returned and the contents of the array are indeterminate. Processed November 7, 1990 STRFTIME(3,L) 4