1 .\" Copyright (c) 1989, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" the American National Standards Committee X3, on Information
6 .\" Processing Systems.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)strftime.3 8.1 (Berkeley) 6/4/93
33 .\" $FreeBSD: head/lib/libc/stdtime/strftime.3 237573 2012-06-25 21:51:40Z issyl0 $
41 .Nd format date and time
48 .Fa "char * restrict buf"
50 .Fa "const char * restrict format"
51 .Fa "const struct tm * restrict timeptr"
54 .Fn strftime_l "char *restrict buf" "size_t maxsize" "const char * restrict format" "const struct tm *restrict timeptr" "locale_t locale"
58 function formats the information from
62 according to the string pointed to by
70 rather than using the current locale.
74 string consists of zero or more conversion specifications and
76 All ordinary characters are copied directly into the buffer.
77 A conversion specification consists of a percent sign
79 and one other character.
83 characters will be placed into the array.
84 If the total number of resulting characters, including the terminating
85 NUL character, is not more than
90 return the number of characters in the array, not counting the
92 Otherwise, zero is returned and the buffer contents are indeterminate.
94 The conversion specifications are copied to the buffer after expansion
96 .Bl -tag -width "xxxx"
98 is replaced by national representation of the full weekday name.
100 is replaced by national representation of
101 the abbreviated weekday name.
103 is replaced by national representation of the full month name.
105 is replaced by national representation of
106 the abbreviated month name.
108 is replaced by (year / 100) as decimal number; single
109 digits are preceded by a zero.
111 is replaced by national representation of time and date.
116 is replaced by the day of the month as a decimal number (01-31).
118 POSIX locale extensions.
120 %Ec %EC %Ex %EX %Ey %EY
121 %Od %Oe %OH %OI %Om %OM
122 %OS %Ou %OU %OV %Ow %OW %Oy
123 are supposed to provide alternate
126 Additionally %OB implemented
127 to represent alternative months names
128 (used standalone, without day mentioned).
130 is replaced by the day of the month as a decimal number (1-31); single
131 digits are preceded by a blank.
136 is replaced by a year as a decimal number with century.
137 This year is the one that contains the greater part of
138 the week (Monday as the first day of the week).
140 is replaced by the same year as in
142 but as a decimal number without century (00-99).
144 is replaced by the hour (24-hour clock) as a decimal number (00-23).
149 is replaced by the hour (12-hour clock) as a decimal number (01-12).
151 is replaced by the day of the year as a decimal number (001-366).
153 is replaced by the hour (24-hour clock) as a decimal number (0-23);
154 single digits are preceded by a blank.
156 is replaced by the hour (12-hour clock) as a decimal number (1-12);
157 single digits are preceded by a blank.
159 is replaced by the minute as a decimal number (00-59).
161 is replaced by the month as a decimal number (01-12).
163 is replaced by a newline.
168 is replaced by national representation of either
169 "ante meridiem" (a.m.)
171 "post meridiem" (p.m.)
180 is replaced by the second as a decimal number (00-60).
182 is replaced by the number of seconds since the Epoch (see
188 is replaced by a tab.
190 is replaced by the week number of the year (Sunday as the first day of
191 the week) as a decimal number (00-53).
193 is replaced by the weekday (Monday as the first day of the week)
194 as a decimal number (1-7).
196 is replaced by the week number of the year (Monday as the first day of
197 the week) as a decimal number (01-53).
198 If the week containing January
199 1 has four or more days in the new year, then it is week 1; otherwise
200 it is the last week of the previous year, and the next week is week 1.
205 is replaced by the week number of the year (Monday as the first day of
206 the week) as a decimal number (00-53).
208 is replaced by the weekday (Sunday as the first day of the week)
209 as a decimal number (0-6).
211 is replaced by national representation of the time.
213 is replaced by national representation of the date.
215 is replaced by the year with century as a decimal number.
217 is replaced by the year without century as a decimal number (00-99).
219 is replaced by the time zone name.
221 is replaced by the offset from the Prime Meridian;
222 a leading plus sign stands for
223 east of Greenwich, a minus sign for west of Greenwich,
224 hours and minutes follow
225 with two digits each and no delimiter between them (common form for
226 RFC 822 date headers).
228 is replaced by national representation of the date and time
229 (the format is similar to that produced by
233 Do not do any padding when performing numerical outputs.
236 Explicitly specify space for padding.
239 Explicitly specify zero for padding.
257 with a lot of extensions including
279 The peculiar week number and year in the replacements of
284 are defined in ISO 8601: 1988.
290 There is no conversion specification for the phase of the moon.
296 functions do not correctly handle multibyte characters in the