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 .\" 4. 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: src/lib/libc/stdtime/strftime.3,v 1.40 2008/05/16 04:33:04 grog Exp $
40 .Nd format date and time
47 .Fa "char * restrict buf"
49 .Fa "const char * restrict format"
50 .Fa "const struct tm * restrict timeptr"
55 function formats the information from
59 according to the string pointed to by
64 string consists of zero or more conversion specifications and
66 All ordinary characters are copied directly into the buffer.
67 A conversion specification consists of a percent sign
69 and one other character.
73 characters will be placed into the array.
74 If the total number of resulting characters, including the terminating
75 NUL character, is not more than
78 returns the number of characters in the array, not counting the
80 Otherwise, zero is returned and the buffer contents are indeterminate.
82 The conversion specifications are copied to the buffer after expansion
84 .Bl -tag -width "xxxx"
86 is replaced by national representation of the full weekday name.
88 is replaced by national representation of
89 the abbreviated weekday name.
91 is replaced by national representation of the full month name.
93 is replaced by national representation of
94 the abbreviated month name.
96 is replaced by (year / 100) as decimal number; single
97 digits are preceded by a zero.
99 is replaced by national representation of time and date.
104 is replaced by the day of the month as a decimal number (01-31).
106 POSIX locale extensions.
108 %Ec %EC %Ex %EX %Ey %EY
109 %Od %Oe %OH %OI %Om %OM
110 %OS %Ou %OU %OV %Ow %OW %Oy
111 are supposed to provide alternate
114 Additionally %OB implemented
115 to represent alternative months names
116 (used standalone, without day mentioned).
118 is replaced by the day of the month as a decimal number (1-31); single
119 digits are preceded by a blank.
124 is replaced by a year as a decimal number with century.
125 This year is the one that contains the greater part of
126 the week (Monday as the first day of the week).
128 is replaced by the same year as in
130 but as a decimal number without century (00-99).
132 is replaced by the hour (24-hour clock) as a decimal number (00-23).
137 is replaced by the hour (12-hour clock) as a decimal number (01-12).
139 is replaced by the day of the year as a decimal number (001-366).
141 is replaced by the hour (24-hour clock) as a decimal number (0-23);
142 single digits are preceded by a blank.
144 is replaced by the hour (12-hour clock) as a decimal number (1-12);
145 single digits are preceded by a blank.
147 is replaced by the minute as a decimal number (00-59).
149 is replaced by the month as a decimal number (01-12).
151 is replaced by a newline.
156 is replaced by national representation of either
157 "ante meridiem" (a.m.)
159 "post meridiem" (p.m.)
168 is replaced by the second as a decimal number (00-60).
170 is replaced by the number of seconds since the Epoch, UTC (see
176 is replaced by a tab.
178 is replaced by the week number of the year (Sunday as the first day of
179 the week) as a decimal number (00-53).
181 is replaced by the weekday (Monday as the first day of the week)
182 as a decimal number (1-7).
184 is replaced by the week number of the year (Monday as the first day of
185 the week) as a decimal number (01-53).
186 If the week containing January
187 1 has four or more days in the new year, then it is week 1; otherwise
188 it is the last week of the previous year, and the next week is week 1.
193 is replaced by the week number of the year (Monday as the first day of
194 the week) as a decimal number (00-53).
196 is replaced by the weekday (Sunday as the first day of the week)
197 as a decimal number (0-6).
199 is replaced by national representation of the time.
201 is replaced by national representation of the date.
203 is replaced by the year with century as a decimal number.
205 is replaced by the year without century as a decimal number (00-99).
207 is replaced by the time zone name.
209 is replaced by the time zone offset from UTC; a leading plus sign stands for
210 east of UTC, a minus sign for west of UTC, hours and minutes follow
211 with two digits each and no delimiter between them (common form for
212 RFC 822 date headers).
214 is replaced by national representation of the date and time
215 (the format is similar to that produced by
219 Do not do any padding when performing numerical outputs.
222 Explicitly specify space for padding.
225 Explicitly specify zero for padding.
243 with a lot of extensions including
265 The peculiar week number and year in the replacements of
270 are defined in ISO 8601: 1988.
272 There is no conversion specification for the phase of the moon.
276 function does not correctly handle multibyte characters in the