Merge commit 'b31320a79e2054c6739b5229259dbf98f3afc547' into merges
[unleashed.git] / contrib / tzcode / newstrftime.3.txt
blob52daff142abf469249eb90ddc9df3d4e3c05821b
1 NEWSTRFTIME(3)             Library Functions Manual             NEWSTRFTIME(3)
3 NAME
4        strftime - format date and time
6 SYNOPSIS
7        #include <time.h>
9        size_t strftime(char *restrict buf, size_t maxsize,
10            char const *restrict format, struct tm const *restrict timeptr);
12        cc ... -ltz
14 DESCRIPTION
15        The strftime function formats the information from timeptr into the
16        buffer buf according to the string pointed to by format.
18        The format string consists of zero or more conversion specifications
19        and ordinary characters.  All ordinary characters are copied directly
20        into the buffer.  A conversion specification consists of a percent sign
21        and one other character.
23        No more than maxsize characters are placed into the array.  If the
24        total number of resulting characters, including the terminating null
25        character, is not more than maxsize, strftime returns the number of
26        characters in the array, not counting the terminating null.  Otherwise,
27        zero is returned.
29        Each conversion specification is replaced by the characters as follows
30        which are then copied into the buffer.
32        %A     is replaced by the locale's full weekday name.
34        %a     is replaced by the locale's abbreviated weekday name.
36        %B     is replaced by the locale's full month name.
38        %b or %h
39               is replaced by the locale's abbreviated month name.
41        %C     is replaced by the century (a year divided by 100 and truncated
42               to an integer) as a decimal number (00-99).
44        %c     is replaced by the locale's appropriate date and time
45               representation.
47        %D     is replaced by the date in the format %m/%d/%y.
49        %d     is replaced by the day of the month as a decimal number (01-31).
51        %e     is replaced by the day of month as a decimal number (1-31);
52               single digits are preceded by a blank.
54        %F     is replaced by the date in the format %Y-%m-%d.
56        %G     is replaced by the ISO 8601 year with century as a decimal
57               number.
59        %g     is replaced by the ISO 8601 year without century as a decimal
60               number (00-99).
62        %H     is replaced by the hour (24-hour clock) as a decimal number
63               (00-23).
65        %I     is replaced by the hour (12-hour clock) as a decimal number
66               (01-12).
68        %j     is replaced by the day of the year as a decimal number
69               (001-366).
71        %k     is replaced by the hour (24-hour clock) as a decimal number
72               (0-23); single digits are preceded by a blank.
74        %l     is replaced by the hour (12-hour clock) as a decimal number
75               (1-12); single digits are preceded by a blank.
77        %M     is replaced by the minute as a decimal number (00-59).
79        %m     is replaced by the month as a decimal number (01-12).
81        %n     is replaced by a newline.
83        %p     is replaced by the locale's equivalent of either AM or PM.
85        %R     is replaced by the time in the format %H:%M.
87        %r     is replaced by the locale's representation of 12-hour clock time
88               using AM/PM notation.
90        %S     is replaced by the second as a decimal number (00-60).
92        %s     is replaced by the number of seconds since the Epoch (see
93               newctime(3)).
95        %T     is replaced by the time in the format %H:%M:%S.
97        %t     is replaced by a tab.
99        %U     is replaced by the week number of the year (Sunday as the first
100               day of the week) as a decimal number (00-53).
102        %u     is replaced by the weekday (Monday as the first day of the week)
103               as a decimal number (1-7).
105        %V     is replaced by the week number of the year (Monday as the first
106               day of the week) as a decimal number (01-53).  If the week
107               containing January 1 has four or more days in the new year, then
108               it is week 1; otherwise it is week 53 of the previous year, and
109               the next week is week 1.
111        %W     is replaced by the week number of the year (Monday as the first
112               day of the week) as a decimal number (00-53).
114        %w     is replaced by the weekday (Sunday as the first day of the week)
115               as a decimal number (0-6).
117        %X     is replaced by the locale's appropriate time representation.
119        %x     is replaced by the locale's appropriate date representation.
121        %Y     is replaced by the year with century as a decimal number.
123        %y     is replaced by the year without century as a decimal number
124               (00-99).
126        %Z     is replaced by the time zone name, or by the empty string if
127               this is not determinable.
129        %z     is replaced by the offset from the Prime Meridian in the format
130               +HHMM or -HHMM as appropriate, with positive values representing
131               locations east of Greenwich, or by the empty string if this is
132               not determinable.  The numeric time zone -0000 is used when the
133               time is Universal Time but local time is indeterminate; by
134               convention this is used for locations while uninhabited, and
135               corresponds to a zero offset when the time zone abbreviation
136               begins with "-".
138        %%     is replaced by a single %.
140        %+     is replaced by the date and time in date(1) format.
142 SEE ALSO
143        date(1), getenv(3), newctime(3), newtzset(3), time(2), tzfile(5)
145                                                                 NEWSTRFTIME(3)