HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
s
strftime(3C) strftime(3C)
NAME
strftime() - convert date and time to string
SYNOPSIS
#include <time.h>
size_t strftime(
char *s,
size_t maxsize,
const char *format,
const struct tm *timeptr
);
DESCRIPTION
The strftime() function converts the contents of a tm structure (see ctime(3C)) to a formatted date and
time string.
strftime() places characters into the array pointed to by s as controlled by the string pointed to by for-
mat. The format string consists of zero or more directives and ordinary characters. A directive consists of
a % character, an optional field width and precision specification, and a terminating character that deter-
mines the directives behavior. All ordinary characters (including the terminating null character are copied
unchanged into the array. No more than maxsize characters are placed into the array. Each directive is
replaced by the appropriate characters as described in the following list. The appropriate characters are
determined by the program’s locale, by the values contained in the structure pointed to by timeptr, and by
the
TZ environment variable (see External Influences below).
Directives
The following directives, shown without the optional field width and precision specification, are replaced by
the indicated characters:
%a Locale’s abbreviated weekday name.
%A Locale’s full weekday name.
%b Locale’s abbreviated month name.
%B Locale’s full month name.
%c Locale’s appropriate date and time representation.
%C The century number (the year divided by 100 and truncated to an integer) as a decimal
number [00-99].
%d Day of the month as a decimal number [01,31].
%D Equivalent to the directive string %m/%d/%y.
%e Day of the month as a decimal number [1,31]; a single digit is preceded by a space.
%h Equivalent to %b.
%H Hour (24-hour clock) as a decimal number [00,23].
%I Hour (12-hour clock) as a decimal number [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].
%n The New-line character.
%p Locale’s equivalent of either AM or PM.
%r The time in AM and PM notation; in the POSIX locale this is equivalent to %I:%M:%S
%p
.
%R The time in 24 hour notation (%H:%M).
%S Second as a decimal number [00,61].
%t The Tab character.
%T The time in hours, minutes, and seconds (%H:%M:%S).
%u The weekday as a decimal number [1(Monday),7].
%U Week number of the year (Sunday as the first day of the week) as a decimal number
[00,53]. All days in a new year preceding the first Sunday are considered to be in week 0.
%V The week number of the year (Monday as the first day of the week) as a decimal number
[01,53]. If the week containing January 1st has four or more days in the new year, then it
is considered week 1; otherwise, it is the last week of the previous year, and the next week
is week 1.
%w Weekday as a decimal number [0(Sunday),6].
%W Week number of the year (Monday as the first day of the week) as a decimal number
[00,53]. All days in a new year preceding the first Monday are considered to be in week 0.
Section 3882 1 HP-UX Release 11i: December 2000
___
___