Fixed license declaration at spec file
[platform/upstream/tzdata.git] / newstrftime.3.txt
1 NEWSTRFTIME(3)             Library Functions Manual             NEWSTRFTIME(3)
2
3 NAME
4        strftime - format date and time
5
6 SYNOPSIS
7        #include <time.h>
8
9        size_t strftime(char *restrict buf, size_t maxsize,
10            char const *restrict format, struct tm const *restrict timeptr);
11
12        cc ... -ltz
13
14 DESCRIPTION
15        The strftime function formats the information from timeptr into the
16        buffer buf according to the string pointed to by format.
17
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.
22
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.
28
29        Each conversion specification is replaced by the characters as follows
30        which are then copied into the buffer.
31
32        %A     is replaced by the locale's full weekday name.
33
34        %a     is replaced by the locale's abbreviated weekday name.
35
36        %B     is replaced by the locale's full month name.
37
38        %b or %h
39               is replaced by the locale's abbreviated month name.
40
41        %C     is replaced by the century (a year divided by 100 and truncated
42               to an integer) as a decimal number (00-99).
43
44        %c     is replaced by the locale's appropriate date and time
45               representation.
46
47        %D     is replaced by the date in the format %m/%d/%y.
48
49        %d     is replaced by the day of the month as a decimal number (01-31).
50
51        %e     is replaced by the day of month as a decimal number (1-31);
52               single digits are preceded by a blank.
53
54        %F     is replaced by the date in the format %Y-%m-%d.
55
56        %G     is replaced by the ISO 8601 year with century as a decimal
57               number.
58
59        %g     is replaced by the ISO 8601 year without century as a decimal
60               number (00-99).
61
62        %H     is replaced by the hour (24-hour clock) as a decimal number
63               (00-23).
64
65        %I     is replaced by the hour (12-hour clock) as a decimal number
66               (01-12).
67
68        %j     is replaced by the day of the year as a decimal number
69               (001-366).
70
71        %k     is replaced by the hour (24-hour clock) as a decimal number
72               (0-23); single digits are preceded by a blank.
73
74        %l     is replaced by the hour (12-hour clock) as a decimal number
75               (1-12); single digits are preceded by a blank.
76
77        %M     is replaced by the minute as a decimal number (00-59).
78
79        %m     is replaced by the month as a decimal number (01-12).
80
81        %n     is replaced by a newline.
82
83        %p     is replaced by the locale's equivalent of either AM or PM.
84
85        %R     is replaced by the time in the format %H:%M.
86
87        %r     is replaced by the locale's representation of 12-hour clock time
88               using AM/PM notation.
89
90        %S     is replaced by the second as a decimal number (00-60).
91
92        %s     is replaced by the number of seconds since the Epoch (see
93               newctime(3)).
94
95        %T     is replaced by the time in the format %H:%M:%S.
96
97        %t     is replaced by a tab.
98
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).
101
102        %u     is replaced by the weekday (Monday as the first day of the week)
103               as a decimal number (1-7).
104
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.
110
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).
113
114        %w     is replaced by the weekday (Sunday as the first day of the week)
115               as a decimal number (0-6).
116
117        %X     is replaced by the locale's appropriate time representation.
118
119        %x     is replaced by the locale's appropriate date representation.
120
121        %Y     is replaced by the year with century as a decimal number.
122
123        %y     is replaced by the year without century as a decimal number
124               (00-99).
125
126        %Z     is replaced by the time zone name, or by the empty string if
127               this is not determinable.
128
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.
133
134        %%     is replaced by a single %.
135
136        %+     is replaced by the date and time in date(1) format.
137
138 SEE ALSO
139        date(1), getenv(3), newctime(3), newtzset(3), time(2), tzfile(5)
140
141                                                                 NEWSTRFTIME(3)