Print this page
4378 Clean up %C in *time() functions
438 need documentation for strftime %s flag
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man3c/strftime.3c
+++ new/usr/src/man/man3c/strftime.3c
1 1 '\" te
2 +.\" Copyright (c) 2014 Gary Mills
2 3 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 4 .\" Copyright 1989 AT&T
4 5 .\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
5 6 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 7 .\" http://www.opengroup.org/bookstore/.
7 8 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 9 .\" This notice shall appear on any product containing this material.
9 10 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
10 11 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
11 12 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 -.TH STRFTIME 3C "Sep 5, 2006"
13 +.TH STRFTIME 3C "Jan 3, 2014"
13 14 .SH NAME
14 15 strftime, cftime, ascftime \- convert date and time to string
15 16 .SH SYNOPSIS
16 17 .LP
17 18 .nf
18 19 #include <time.h>
19 20
20 21 \fBsize_t\fR \fBstrftime\fR(\fBchar *restrict\fR \fIs\fR, \fBsize_t\fR \fImaxsize\fR,
21 22 \fBconst char *restrict\fR \fIformat\fR,
22 23 \fBconst struct tm *restrict\fR \fItimeptr\fR);
23 24 .fi
24 25
25 26 .LP
26 27 .nf
27 28 \fBint\fR \fBcftime\fR(\fBchar *\fR\fIs\fR, \fBchar *\fR\fIformat\fR, \fBconst time_t *\fR\fIclock\fR);
28 29 .fi
29 30
30 31 .LP
31 32 .nf
32 33 \fBint\fR \fBascftime\fR(\fBchar *\fR\fIs\fR, \fBconst char *\fR\fIformat\fR,
33 34 \fBconst struct tm *\fR\fItimeptr\fR);
34 35 .fi
35 36
36 37 .SH DESCRIPTION
37 38 .sp
38 39 .LP
39 40 The \fBstrftime()\fR, \fBascftime()\fR, and \fBcftime()\fR functions place
40 41 bytes into the array pointed to by \fIs\fR as controlled by the string pointed
41 42 to by \fIformat\fR. The \fIformat\fR string consists of zero or more conversion
42 43 specifications and ordinary characters. A conversion specification consists of
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
43 44 a '\fB%\fR' (percent) character and one or two terminating conversion
44 45 characters that determine the conversion specification's behavior. All
45 46 ordinary characters (including the terminating null byte) are copied unchanged
46 47 into the array pointed to by \fIs\fR. If copying takes place between objects
47 48 that overlap, the behavior is undefined. For \fBstrftime()\fR, no more than
48 49 \fImaxsize\fR bytes are placed into the array.
49 50 .sp
50 51 .LP
51 52 If \fIformat\fR is \fB(char *)0\fR, then the locale's default format is used.
52 53 For \fBstrftime()\fR the default format is the same as \fB%c\fR; for
53 -\fBcftime()\fR and \fBascftime()\fR the default format is the same as \fB%C\fR.
54 +\fBcftime()\fR and \fBascftime()\fR the default format is the same as \fB%+\fR.
54 55 \fBcftime()\fR and \fBascftime()\fR first try to use the value of the
55 56 environment variable \fBCFTIME\fR, and if that is undefined or empty, the
56 57 default format is used.
57 58 .sp
58 59 .LP
59 60 Each conversion specification is replaced by appropriate characters as
60 61 described in the following list. The appropriate characters are determined by
61 62 the \fBLC_TIME\fR category of the program's locale and by the values contained
62 63 in the structure pointed to by \fItimeptr\fR for \fBstrftime()\fR and
63 64 \fBascftime()\fR, and by the time represented by \fIclock\fR for
64 65 \fBcftime()\fR.
65 66 .sp
66 67 .ne 2
67 68 .na
68 69 \fB\fB%%\fR\fR
69 70 .ad
70 71 .RS 6n
71 72 Same as \fB%\fR.
72 73 .RE
73 74
74 75 .sp
75 76 .ne 2
76 77 .na
77 78 \fB\fB%a\fR\fR
78 79 .ad
79 80 .RS 6n
80 81 Locale's abbreviated weekday name.
81 82 .RE
82 83
83 84 .sp
84 85 .ne 2
85 86 .na
86 87 \fB\fB%A\fR\fR
87 88 .ad
88 89 .RS 6n
89 90 Locale's full weekday name.
90 91 .RE
91 92
92 93 .sp
93 94 .ne 2
94 95 .na
95 96 \fB\fB%b\fR\fR
96 97 .ad
97 98 .RS 6n
98 99 Locale's abbreviated month name.
99 100 .RE
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
100 101
101 102 .sp
102 103 .ne 2
103 104 .na
104 105 \fB\fB%B\fR\fR
105 106 .ad
106 107 .RS 6n
107 108 Locale's full month name.
108 109 .RE
109 110
110 -.SS "Default"
111 111 .sp
112 112 .ne 2
113 113 .na
114 114 \fB\fB%c\fR\fR
115 115 .ad
116 116 .RS 6n
117 -Locale's appropriate date and time represented as:
117 +Locale's appropriate date and time representation.
118 +In the C locale, this format is:
118 119 .sp
119 120 .in +2
120 121 .nf
121 -%a %b %d %H:%M:%S %Y
122 -.fi
123 -.in -2
124 -
125 -This is the default behavior as well as standard-conforming behavior for
126 -standards first supported by releases prior to Solaris 2.4. See
127 -\fBstandards\fR(5).
128 -.RE
129 -
130 -.SS "Standard conforming"
131 -.sp
132 -.ne 2
133 -.na
134 -\fB\fB%c\fR\fR
135 -.ad
136 -.RS 6n
137 -Locale's appropriate date and time represented as:
138 -.sp
139 -.in +2
140 -.nf
141 122 %a %b %e %H:%M:%S %Y
142 123 .fi
143 124 .in -2
144 -
145 -This is standard-conforming behavior for standards first supported by Solaris
146 -2.4 through Solaris 10.
147 -.RE
148 -
149 -.SS "Default"
150 125 .sp
151 -.ne 2
152 -.na
153 -\fB\fB%C\fR\fR
154 -.ad
155 -.RS 6n
156 -Locale's date and time representation as produced by \fBdate\fR(1).
157 -.sp
158 -This is the default behavior as well as standard-conforming behavior for
159 -standards first supported by releases prior to Solaris 2.4.
126 +Other locales may have different locale-specific formats.
160 127 .RE
161 128
162 -.SS "Standard conforming"
163 129 .sp
164 130 .ne 2
165 131 .na
166 132 \fB\fB%C\fR\fR
167 133 .ad
168 134 .RS 6n
169 135 Century number (the year divided by 100 and truncated to an integer as a
170 136 decimal number [01,99]).
171 -.sp
172 -This is standard-conforming behavior for standards first supported by Solaris
173 -2.4 through Solaris 10.
174 137 .RE
175 138
176 139 .sp
177 140 .ne 2
178 141 .na
179 142 \fB\fB%d\fR\fR
180 143 .ad
181 144 .RS 6n
182 145 Day of month [01,31].
183 146 .RE
184 147
185 148 .sp
186 149 .ne 2
187 150 .na
188 151 \fB\fB%D\fR\fR
189 152 .ad
190 153 .RS 6n
191 154 Date as \fB%m\fR/\fB%d\fR/\fB%y\fR.
192 155 .RE
193 156
194 157 .sp
195 158 .ne 2
196 159 .na
197 160 \fB\fB%e\fR\fR
198 161 .ad
199 162 .RS 6n
200 163 Day of month [1,31]; single digits are preceded by a space.
201 164 .RE
202 165
203 166 .sp
204 167 .ne 2
205 168 .na
206 169 \fB\fB%F\fR\fR
207 170 .ad
208 171 .RS 6n
209 172 Equivalent to \fB%Y\fR-\fB%m\fR-\fB%d\fR (the ISO 8601:2000 standard date
210 173 format).
211 174 .RE
212 175
213 176 .sp
214 177 .ne 2
215 178 .na
216 179 \fB\fB%g\fR\fR
217 180 .ad
218 181 .RS 6n
219 182 Week-based year within century [00,99].
220 183 .RE
221 184
222 185 .sp
223 186 .ne 2
224 187 .na
225 188 \fB\fB%G\fR\fR
226 189 .ad
227 190 .RS 6n
228 191 Week-based year, including the century [0000,9999].
229 192 .RE
230 193
231 194 .sp
232 195 .ne 2
233 196 .na
234 197 \fB\fB%h\fR\fR
235 198 .ad
236 199 .RS 6n
237 200 Locale's abbreviated month name.
238 201 .RE
239 202
240 203 .sp
241 204 .ne 2
242 205 .na
243 206 \fB\fB%H\fR\fR
244 207 .ad
245 208 .RS 6n
246 209 Hour (24-hour clock) [00,23].
247 210 .RE
248 211
249 212 .sp
250 213 .ne 2
251 214 .na
252 215 \fB\fB%I\fR\fR
253 216 .ad
254 217 .RS 6n
255 218 Hour (12-hour clock) [01,12].
256 219 .RE
257 220
258 221 .sp
259 222 .ne 2
260 223 .na
261 224 \fB\fB%j\fR\fR
262 225 .ad
263 226 .RS 6n
264 227 Day number of year [001,366].
265 228 .RE
266 229
267 230 .sp
268 231 .ne 2
269 232 .na
270 233 \fB\fB%k\fR\fR
271 234 .ad
272 235 .RS 6n
273 236 Hour (24-hour clock) [0,23]; single digits are preceded by a space.
274 237 .RE
275 238
276 239 .sp
277 240 .ne 2
278 241 .na
279 242 \fB\fB%l\fR\fR
280 243 .ad
281 244 .RS 6n
282 245 Hour (12-hour clock) [1,12]; single digits are preceded by a space.
283 246 .RE
284 247
285 248 .sp
286 249 .ne 2
287 250 .na
288 251 \fB\fB%m\fR\fR
289 252 .ad
290 253 .RS 6n
291 254 Month number [01,12].
292 255 .RE
293 256
294 257 .sp
295 258 .ne 2
296 259 .na
297 260 \fB\fB%M\fR\fR
298 261 .ad
299 262 .RS 6n
300 263 Minute [00,59].
301 264 .RE
302 265
303 266 .sp
304 267 .ne 2
305 268 .na
306 269 \fB\fB%n\fR\fR
307 270 .ad
308 271 .RS 6n
309 272 Insert a NEWLINE.
310 273 .RE
311 274
312 275 .sp
313 276 .ne 2
314 277 .na
315 278 \fB\fB%p\fR\fR
316 279 .ad
317 280 .RS 6n
318 281 Locale's equivalent of either a.m. or p.m.
319 282 .RE
320 283
321 284 .sp
322 285 .ne 2
323 286 .na
324 287 \fB\fB%r\fR\fR
325 288 .ad
326 289 .RS 6n
327 290 Appropriate time representation in 12-hour clock format with \fB%p\fR.
328 291 .RE
329 292
330 293 .sp
331 294 .ne 2
↓ open down ↓ |
148 lines elided |
↑ open up ↑ |
332 295 .na
333 296 \fB\fB%R\fR\fR
334 297 .ad
335 298 .RS 6n
336 299 Time as \fB%H\fR:\fB%M\fR.
337 300 .RE
338 301
339 302 .sp
340 303 .ne 2
341 304 .na
305 +\fB\fB%s\fR\fR
306 +.ad
307 +.RS 6n
308 +Seconds since 00:00:00 UTC, January 1, 1970.
309 +.RE
310 +
311 +.sp
312 +.ne 2
313 +.na
342 314 \fB\fB%S\fR\fR
343 315 .ad
344 316 .RS 6n
345 317 Seconds [00,60]; the range of values is [00,60] rather than [00,59] to allow
346 318 for the occasional leap second.
347 319 .RE
348 320
349 321 .sp
350 322 .ne 2
351 323 .na
352 324 \fB\fB%t\fR\fR
353 325 .ad
354 326 .RS 6n
355 327 Insert a TAB.
356 328 .RE
357 329
358 330 .sp
359 331 .ne 2
360 332 .na
361 333 \fB\fB%T\fR\fR
362 334 .ad
363 335 .RS 6n
364 336 Time as \fB%H\fR:\fB%M\fR:\fB%S\fR.
365 337 .RE
366 338
367 339 .sp
368 340 .ne 2
369 341 .na
370 342 \fB\fB%u\fR\fR
371 343 .ad
372 344 .RS 6n
373 345 Weekday as a decimal number [1,7], with 1 representing Monday. See \fBNOTES\fR
374 346 below.
375 347 .RE
376 348
377 349 .sp
378 350 .ne 2
379 351 .na
↓ open down ↓ |
28 lines elided |
↑ open up ↑ |
380 352 \fB\fB%U\fR\fR
381 353 .ad
382 354 .RS 6n
383 355 Week number of year as a decimal number [00,53], with Sunday as the first day
384 356 of week 1.
385 357 .RE
386 358
387 359 .sp
388 360 .ne 2
389 361 .na
362 +\fB\fB%v\fR\fR
363 +.ad
364 +.RS 6n
365 +Date as \fB%e\fR-\fB%b\fR-\fB%Y\fR.
366 +.RE
367 +
368 +.sp
369 +.ne 2
370 +.na
390 371 \fB\fB%V\fR\fR
391 372 .ad
392 373 .RS 6n
393 374 The ISO 8601 week number as a decimal number [01,53]. In the ISO 8601
394 375 week-based system, weeks begin on a Monday and week 1 of the year is the week
395 376 that includes both January 4th and the first Thursday of the year. If the
396 377 first Monday of January is the 2nd, 3rd, or 4th, the preceding days are part of
397 378 the last week of the preceding year. See \fBNOTES\fR below.
398 379 .RE
399 380
400 381 .sp
401 382 .ne 2
402 383 .na
403 384 \fB\fB%w\fR\fR
404 385 .ad
405 386 .RS 6n
406 387 Weekday as a decimal number [0,6], with 0 representing Sunday.
407 388 .RE
408 389
409 390 .sp
410 391 .ne 2
411 392 .na
412 393 \fB\fB%W\fR\fR
413 394 .ad
414 395 .RS 6n
415 396 Week number of year as a decimal number [00,53], with Monday as the first day
416 397 of week 1.
417 398 .RE
418 399
419 400 .sp
420 401 .ne 2
421 402 .na
422 403 \fB\fB%x\fR\fR
423 404 .ad
424 405 .RS 6n
425 406 Locale's appropriate date representation.
426 407 .RE
427 408
428 409 .sp
429 410 .ne 2
430 411 .na
431 412 \fB\fB%X\fR\fR
432 413 .ad
433 414 .RS 6n
434 415 Locale's appropriate time representation.
435 416 .RE
436 417
437 418 .sp
438 419 .ne 2
439 420 .na
440 421 \fB\fB%y\fR\fR
441 422 .ad
442 423 .RS 6n
443 424 Year within century [00,99].
444 425 .RE
445 426
446 427 .sp
447 428 .ne 2
448 429 .na
449 430 \fB\fB%Y\fR\fR
450 431 .ad
451 432 .RS 6n
452 433 Year, including the century (for example 1993).
453 434 .RE
454 435
455 436 .sp
456 437 .ne 2
457 438 .na
458 439 \fB\fB%z\fR\fR
459 440 .ad
460 441 .RS 6n
461 442 Replaced by offset from UTC in ISO 8601:2000 standard format (\fB+hhmm\fR or
462 443 \fB-hhmm\fR), or by no characters if no time zone is determinable. For example,
463 444 "-0430" means 4 hours 30 minutes behind UTC (west of Greenwich). If
464 445 \fBtm_isdst\fR is zero, the standard time offset is used. If \fBtm_isdst\fR is
465 446 greater than zero, the daylight savings time offset if used. If \fBtm_isdst\fR
466 447 is negative, no characters are returned.
467 448 .RE
468 449
↓ open down ↓ |
69 lines elided |
↑ open up ↑ |
469 450 .sp
470 451 .ne 2
471 452 .na
472 453 \fB\fB%Z\fR\fR
473 454 .ad
474 455 .RS 6n
475 456 Time zone name or abbreviation, or no bytes if no time zone information exists.
476 457 .RE
477 458
478 459 .sp
460 +.ne 2
461 +.na
462 +\fB\fB%+\fR\fR
463 +.ad
464 +.RS 6n
465 +Locale's date and time representation as produced by \fBdate\fR(1).
466 +.RE
467 +
468 +.sp
479 469 .LP
480 470 If a conversion specification does not correspond to any of the above or to any
481 471 of the modified conversion specifications listed below, the behavior is
482 472 undefined and \fB0\fR is returned.
483 473 .sp
484 474 .LP
485 475 The difference between \fB%U\fR and \fB%W\fR (and also between modified
486 476 conversion specifications \fB%OU\fR and \fB%OW\fR) lies in which day is counted
487 477 as the first of the week. Week number 1 is the first week in January starting
488 478 with a Sunday for \fB%U\fR or a Monday for \fB%W\fR. Week number 0 contains
489 479 those days before the first Sunday or Monday in January for \fB%U\fR and
490 480 \fB%W\fR, respectively.
491 481 .SS "Modified Conversion Specifications"
492 482 .sp
493 483 .LP
494 484 Some conversion specifications can be modified by the \fBE\fR and \fBO\fR
495 485 modifiers to indicate that an alternate format or specification should be used
496 486 rather than the one normally used by the unmodified conversion specification.
497 487 If the alternate format or specification does not exist in the current locale,
498 488 the behavior will be as if the unmodified specification were used.
499 489 .sp
500 490 .ne 2
501 491 .na
502 492 \fB\fB%Ec\fR\fR
503 493 .ad
504 494 .RS 7n
505 495 Locale's alternate appropriate date and time representation.
506 496 .RE
507 497
508 498 .sp
509 499 .ne 2
510 500 .na
511 501 \fB\fB%EC\fR\fR
512 502 .ad
513 503 .RS 7n
514 504 Name of the base year (period) in the locale's alternate representation.
515 505 .RE
516 506
517 507 .sp
518 508 .ne 2
519 509 .na
520 510 \fB\fB%Eg\fR\fR
521 511 .ad
522 512 .RS 7n
523 513 Offset from \fB%EC\fR of the week-based year in the locale's alternative
524 514 representation.
525 515 .RE
526 516
527 517 .sp
528 518 .ne 2
529 519 .na
530 520 \fB\fB%EG\fR\fR
531 521 .ad
532 522 .RS 7n
533 523 Full alternative representation of the week-based year.
534 524 .RE
535 525
536 526 .sp
537 527 .ne 2
538 528 .na
539 529 \fB\fB%Ex\fR\fR
540 530 .ad
541 531 .RS 7n
542 532 Locale's alternate date representation.
543 533 .RE
544 534
545 535 .sp
546 536 .ne 2
547 537 .na
548 538 \fB\fB%EX\fR\fR
549 539 .ad
550 540 .RS 7n
551 541 Locale's alternate time representation.
552 542 .RE
553 543
554 544 .sp
555 545 .ne 2
556 546 .na
557 547 \fB\fB%Ey\fR\fR
558 548 .ad
559 549 .RS 7n
560 550 Offset from \fB%EC\fR (year only) in the locale's alternate representation.
561 551 .RE
562 552
563 553 .sp
564 554 .ne 2
565 555 .na
566 556 \fB\fB%EY\fR\fR
567 557 .ad
568 558 .RS 7n
569 559 Full alternate year representation.
570 560 .RE
571 561
572 562 .sp
573 563 .ne 2
574 564 .na
575 565 \fB\fB%Od\fR\fR
576 566 .ad
577 567 .RS 7n
578 568 Day of the month using the locale's alternate numeric symbols.
579 569 .RE
580 570
581 571 .sp
582 572 .ne 2
583 573 .na
584 574 \fB\fB%Oe\fR\fR
585 575 .ad
586 576 .RS 7n
587 577 Same as \fB%Od\fR.
588 578 .RE
589 579
590 580 .sp
591 581 .ne 2
592 582 .na
593 583 \fB\fB%Og\fR\fR
594 584 .ad
595 585 .RS 7n
596 586 Week-based year (offset from \fB%C\fR) in the locale's alternate representation
597 587 and using the locale's alternate numeric symbols.
598 588 .RE
599 589
600 590 .sp
601 591 .ne 2
602 592 .na
603 593 \fB\fB%OH\fR\fR
604 594 .ad
605 595 .RS 7n
606 596 Hour (24-hour clock) using the locale's alternate numeric symbols.
607 597 .RE
608 598
609 599 .sp
610 600 .ne 2
611 601 .na
612 602 \fB\fB%OI\fR\fR
613 603 .ad
614 604 .RS 7n
615 605 Hour (12-hour clock) using the locale's alternate numeric symbols.
616 606 .RE
617 607
618 608 .sp
619 609 .ne 2
620 610 .na
621 611 \fB\fB%Om\fR\fR
622 612 .ad
623 613 .RS 7n
624 614 Month using the locale's alternate numeric symbols.
625 615 .RE
626 616
627 617 .sp
628 618 .ne 2
629 619 .na
630 620 \fB\fB%OM\fR\fR
631 621 .ad
632 622 .RS 7n
633 623 Minutes using the locale's alternate numeric symbols.
634 624 .RE
635 625
636 626 .sp
637 627 .ne 2
638 628 .na
639 629 \fB\fB%OS\fR\fR
640 630 .ad
641 631 .RS 7n
642 632 Seconds using the locale's alternate numeric symbols.
643 633 .RE
644 634
645 635 .sp
646 636 .ne 2
647 637 .na
648 638 \fB\fB%Ou\fR\fR
649 639 .ad
650 640 .RS 7n
651 641 Weekday as a number in the locale's alternate numeric symbols.
652 642 .RE
653 643
654 644 .sp
655 645 .ne 2
656 646 .na
657 647 \fB\fB%OU\fR\fR
658 648 .ad
659 649 .RS 7n
660 650 Week number of the year (Sunday as the first day of the week) using the
661 651 locale's alternate numeric symbols.
662 652 .RE
663 653
664 654 .sp
665 655 .ne 2
666 656 .na
667 657 \fB\fB%Ow\fR\fR
668 658 .ad
669 659 .RS 7n
670 660 Number of the weekday (Sunday=0) using the locale's alternate numeric symbols.
671 661 .RE
672 662
673 663 .sp
674 664 .ne 2
675 665 .na
676 666 \fB\fB%OW\fR\fR
677 667 .ad
678 668 .RS 7n
679 669 Week number of the year (Monday as the first day of the week) using the
680 670 locale's alternate numeric symbols.
681 671 .RE
682 672
683 673 .sp
684 674 .ne 2
685 675 .na
686 676 \fB\fB%Oy\fR\fR
687 677 .ad
688 678 .RS 7n
689 679 Year (offset from \fB%C\fR) in the locale's alternate representation and using
690 680 the locale's alternate numeric symbols.
691 681 .RE
692 682
693 683 .SS "Selecting the Output Language"
694 684 .sp
695 685 .LP
696 686 By default, the output of \fBstrftime()\fR, \fBcftime()\fR, and
697 687 \fBascftime()\fR appear in U.S. English. The user can request that the output
698 688 of \fBstrftime()\fR, \fBcftime()\fR, or \fBascftime()\fR be in a specific
699 689 language by setting the \fBLC_TIME\fR category using \fBsetlocale()\fR.
700 690 .SS "Time Zone"
701 691 .sp
702 692 .LP
703 693 Local time zone information is used as though \fBtzset\fR(3C) were called.
704 694 .SH RETURN VALUES
705 695 .sp
706 696 .LP
707 697 The \fBstrftime()\fR, \fBcftime()\fR, and \fBascftime()\fR functions return the
708 698 number of characters placed into the array pointed to by \fIs\fR, not including
709 699 the terminating null character. If the total number of resulting characters
710 700 including the terminating null character is more than \fImaxsize\fR,
711 701 \fBstrftime()\fR returns \fB0\fR and the contents of the array are
712 702 indeterminate.
713 703 .SH EXAMPLES
714 704 .LP
715 705 \fBExample 1 \fRAn example of the \fBstrftime()\fR function.
716 706 .sp
717 707 .LP
718 708 The following example illustrates the use of \fBstrftime()\fR for the
719 709 \fBPOSIX\fR locale. It shows what the string in \fIstr\fR would look like if
720 710 the structure pointed to by \fItmptr\fR contains the values corresponding to
721 711 Thursday, August 28, 1986 at 12:44:36.
722 712
723 713 .sp
724 714 .in +2
725 715 .nf
726 716 \fBstrftime (str, strsize, "%A %b %d %j", tmptr)\fR
727 717 .fi
728 718 .in -2
729 719
730 720 .sp
731 721 .LP
732 722 This results in \fIstr\fR containing "Thursday Aug 28 240".
733 723
734 724 .SH ATTRIBUTES
735 725 .sp
736 726 .LP
737 727 See \fBattributes\fR(5) for descriptions of the following attributes:
738 728 .sp
739 729
740 730 .sp
741 731 .TS
742 732 box;
743 733 c | c
744 734 l | l .
745 735 ATTRIBUTE TYPE ATTRIBUTE VALUE
746 736 _
747 737 CSI Enabled
748 738 _
749 739 Interface Stability Committed
750 740 _
751 741 MT-Level MT-Safe
752 742 _
753 743 Standard See below.
754 744 .TE
755 745
756 746 .sp
757 747 .LP
758 748 For \fBstrftime()\fR, see \fBstandards\fR(5).
759 749 .SH SEE ALSO
760 750 .sp
761 751 .LP
762 752 \fBdate\fR(1), \fBctime\fR(3C), \fBmktime\fR(3C), \fBsetlocale\fR(3C),
763 753 \fBstrptime\fR(3C), \fBtzset\fR(3C), \fBTIMEZONE\fR(4), \fBzoneinfo\fR(4),
764 754 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
765 755 .SH NOTES
766 756 .sp
767 757 .LP
768 758 The conversion specification for \fB%V\fR was changed in the Solaris 7 release.
769 759 This change was based on the public review draft of the ISO C9x standard at
770 760 that time. Previously, the specification stated that if the week containing 1
771 761 January had fewer than four days in the new year, it became week 53 of the
772 762 previous year. The ISO C9x standard committee subsequently recognized that that
773 763 specification had been incorrect.
774 764 .sp
775 765 .LP
776 766 The conversion specifications for \fB%g\fR, \fB%G\fR, \fB%Eg\fR, \fB%EG\fR, and
777 767 \fB%Og\fR were added in the Solaris 7 release. This change was based on the
778 768 public review draft of the ISO C9x standard at that time. These specifications
779 769 are evolving. If the ISO C9x standard is finalized with a different
780 770 conclusion, these specifications will change to conform to the ISO C9x standard
↓ open down ↓ |
292 lines elided |
↑ open up ↑ |
781 771 decision.
782 772 .sp
783 773 .LP
784 774 The conversion specification for \fB%u\fR was changed in the Solaris 8 release.
785 775 This change was based on the XPG4 specification.
786 776 .sp
787 777 .LP
788 778 If using the \fB%Z\fR specifier and \fBzoneinfo\fR timezones and if the input
789 779 date is outside the range 20:45:52 UTC, December 13, 1901 to 03:14:07 UTC,
790 780 January 19, 2038, the timezone name may not be correct.
781 +.sp
782 +.LP
783 +The conversion specification for \fB%+\fR was added in illumos.
784 +It is not part of any standard, although it is available on a number
785 +of other platforms.
786 +Its use is discouraged for conforming applications.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX