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 1, 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:
118 -.sp
119 -.in +2
120 -.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).
117 +Locale's appropriate date and time representation.
128 118 .RE
129 119
130 -.SS "Standard conforming"
131 120 .sp
132 121 .ne 2
133 122 .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 -%a %b %e %H:%M:%S %Y
142 -.fi
143 -.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 -.sp
151 -.ne 2
152 -.na
153 123 \fB\fB%C\fR\fR
154 124 .ad
155 125 .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.
160 -.RE
161 -
162 -.SS "Standard conforming"
163 -.sp
164 -.ne 2
165 -.na
166 -\fB\fB%C\fR\fR
167 -.ad
168 -.RS 6n
169 126 Century number (the year divided by 100 and truncated to an integer as a
170 127 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 128 .RE
175 129
176 130 .sp
177 131 .ne 2
178 132 .na
179 133 \fB\fB%d\fR\fR
180 134 .ad
181 135 .RS 6n
182 136 Day of month [01,31].
183 137 .RE
184 138
185 139 .sp
186 140 .ne 2
187 141 .na
188 142 \fB\fB%D\fR\fR
189 143 .ad
190 144 .RS 6n
191 145 Date as \fB%m\fR/\fB%d\fR/\fB%y\fR.
192 146 .RE
193 147
194 148 .sp
195 149 .ne 2
196 150 .na
197 151 \fB\fB%e\fR\fR
198 152 .ad
199 153 .RS 6n
200 154 Day of month [1,31]; single digits are preceded by a space.
201 155 .RE
202 156
203 157 .sp
204 158 .ne 2
205 159 .na
206 160 \fB\fB%F\fR\fR
207 161 .ad
208 162 .RS 6n
209 163 Equivalent to \fB%Y\fR-\fB%m\fR-\fB%d\fR (the ISO 8601:2000 standard date
210 164 format).
211 165 .RE
212 166
213 167 .sp
214 168 .ne 2
215 169 .na
216 170 \fB\fB%g\fR\fR
217 171 .ad
218 172 .RS 6n
219 173 Week-based year within century [00,99].
220 174 .RE
221 175
222 176 .sp
223 177 .ne 2
224 178 .na
225 179 \fB\fB%G\fR\fR
226 180 .ad
227 181 .RS 6n
228 182 Week-based year, including the century [0000,9999].
229 183 .RE
230 184
231 185 .sp
232 186 .ne 2
233 187 .na
234 188 \fB\fB%h\fR\fR
235 189 .ad
236 190 .RS 6n
237 191 Locale's abbreviated month name.
238 192 .RE
239 193
240 194 .sp
241 195 .ne 2
242 196 .na
243 197 \fB\fB%H\fR\fR
244 198 .ad
245 199 .RS 6n
246 200 Hour (24-hour clock) [00,23].
247 201 .RE
248 202
249 203 .sp
250 204 .ne 2
251 205 .na
252 206 \fB\fB%I\fR\fR
253 207 .ad
254 208 .RS 6n
255 209 Hour (12-hour clock) [01,12].
256 210 .RE
257 211
258 212 .sp
259 213 .ne 2
260 214 .na
261 215 \fB\fB%j\fR\fR
262 216 .ad
263 217 .RS 6n
264 218 Day number of year [001,366].
265 219 .RE
266 220
267 221 .sp
268 222 .ne 2
269 223 .na
270 224 \fB\fB%k\fR\fR
271 225 .ad
272 226 .RS 6n
273 227 Hour (24-hour clock) [0,23]; single digits are preceded by a space.
274 228 .RE
275 229
276 230 .sp
277 231 .ne 2
278 232 .na
279 233 \fB\fB%l\fR\fR
280 234 .ad
281 235 .RS 6n
282 236 Hour (12-hour clock) [1,12]; single digits are preceded by a space.
283 237 .RE
284 238
285 239 .sp
286 240 .ne 2
287 241 .na
288 242 \fB\fB%m\fR\fR
289 243 .ad
290 244 .RS 6n
291 245 Month number [01,12].
292 246 .RE
293 247
294 248 .sp
295 249 .ne 2
296 250 .na
297 251 \fB\fB%M\fR\fR
298 252 .ad
299 253 .RS 6n
300 254 Minute [00,59].
301 255 .RE
302 256
303 257 .sp
304 258 .ne 2
305 259 .na
306 260 \fB\fB%n\fR\fR
307 261 .ad
308 262 .RS 6n
309 263 Insert a NEWLINE.
310 264 .RE
311 265
312 266 .sp
313 267 .ne 2
314 268 .na
315 269 \fB\fB%p\fR\fR
316 270 .ad
317 271 .RS 6n
318 272 Locale's equivalent of either a.m. or p.m.
319 273 .RE
320 274
321 275 .sp
322 276 .ne 2
323 277 .na
324 278 \fB\fB%r\fR\fR
325 279 .ad
326 280 .RS 6n
327 281 Appropriate time representation in 12-hour clock format with \fB%p\fR.
328 282 .RE
329 283
330 284 .sp
331 285 .ne 2
↓ open down ↓ |
148 lines elided |
↑ open up ↑ |
332 286 .na
333 287 \fB\fB%R\fR\fR
334 288 .ad
335 289 .RS 6n
336 290 Time as \fB%H\fR:\fB%M\fR.
337 291 .RE
338 292
339 293 .sp
340 294 .ne 2
341 295 .na
296 +\fB\fB%s\fR\fR
297 +.ad
298 +.RS 6n
299 +Seconds since 00:00:00 UTC, January 1, 1970.
300 +.RE
301 +
302 +.sp
303 +.ne 2
304 +.na
342 305 \fB\fB%S\fR\fR
343 306 .ad
344 307 .RS 6n
345 308 Seconds [00,60]; the range of values is [00,60] rather than [00,59] to allow
346 309 for the occasional leap second.
347 310 .RE
348 311
349 312 .sp
350 313 .ne 2
351 314 .na
352 315 \fB\fB%t\fR\fR
353 316 .ad
354 317 .RS 6n
355 318 Insert a TAB.
356 319 .RE
357 320
358 321 .sp
359 322 .ne 2
360 323 .na
361 324 \fB\fB%T\fR\fR
362 325 .ad
363 326 .RS 6n
364 327 Time as \fB%H\fR:\fB%M\fR:\fB%S\fR.
365 328 .RE
366 329
367 330 .sp
368 331 .ne 2
369 332 .na
370 333 \fB\fB%u\fR\fR
371 334 .ad
372 335 .RS 6n
373 336 Weekday as a decimal number [1,7], with 1 representing Monday. See \fBNOTES\fR
374 337 below.
375 338 .RE
376 339
377 340 .sp
378 341 .ne 2
379 342 .na
↓ open down ↓ |
28 lines elided |
↑ open up ↑ |
380 343 \fB\fB%U\fR\fR
381 344 .ad
382 345 .RS 6n
383 346 Week number of year as a decimal number [00,53], with Sunday as the first day
384 347 of week 1.
385 348 .RE
386 349
387 350 .sp
388 351 .ne 2
389 352 .na
353 +\fB\fB%v\fR\fR
354 +.ad
355 +.RS 6n
356 +Date as \fB%e\fR-\fB%b\fR-\fB%Y\fR.
357 +.RE
358 +
359 +.sp
360 +.ne 2
361 +.na
390 362 \fB\fB%V\fR\fR
391 363 .ad
392 364 .RS 6n
393 365 The ISO 8601 week number as a decimal number [01,53]. In the ISO 8601
394 366 week-based system, weeks begin on a Monday and week 1 of the year is the week
395 367 that includes both January 4th and the first Thursday of the year. If the
396 368 first Monday of January is the 2nd, 3rd, or 4th, the preceding days are part of
397 369 the last week of the preceding year. See \fBNOTES\fR below.
398 370 .RE
399 371
400 372 .sp
401 373 .ne 2
402 374 .na
403 375 \fB\fB%w\fR\fR
404 376 .ad
405 377 .RS 6n
406 378 Weekday as a decimal number [0,6], with 0 representing Sunday.
407 379 .RE
408 380
409 381 .sp
410 382 .ne 2
411 383 .na
412 384 \fB\fB%W\fR\fR
413 385 .ad
414 386 .RS 6n
415 387 Week number of year as a decimal number [00,53], with Monday as the first day
416 388 of week 1.
417 389 .RE
418 390
419 391 .sp
420 392 .ne 2
421 393 .na
422 394 \fB\fB%x\fR\fR
423 395 .ad
424 396 .RS 6n
425 397 Locale's appropriate date representation.
426 398 .RE
427 399
428 400 .sp
429 401 .ne 2
430 402 .na
431 403 \fB\fB%X\fR\fR
432 404 .ad
433 405 .RS 6n
434 406 Locale's appropriate time representation.
435 407 .RE
436 408
437 409 .sp
438 410 .ne 2
439 411 .na
440 412 \fB\fB%y\fR\fR
441 413 .ad
442 414 .RS 6n
443 415 Year within century [00,99].
444 416 .RE
445 417
446 418 .sp
447 419 .ne 2
448 420 .na
449 421 \fB\fB%Y\fR\fR
450 422 .ad
451 423 .RS 6n
452 424 Year, including the century (for example 1993).
453 425 .RE
454 426
455 427 .sp
456 428 .ne 2
457 429 .na
458 430 \fB\fB%z\fR\fR
459 431 .ad
460 432 .RS 6n
461 433 Replaced by offset from UTC in ISO 8601:2000 standard format (\fB+hhmm\fR or
462 434 \fB-hhmm\fR), or by no characters if no time zone is determinable. For example,
463 435 "-0430" means 4 hours 30 minutes behind UTC (west of Greenwich). If
464 436 \fBtm_isdst\fR is zero, the standard time offset is used. If \fBtm_isdst\fR is
465 437 greater than zero, the daylight savings time offset if used. If \fBtm_isdst\fR
466 438 is negative, no characters are returned.
467 439 .RE
↓ open down ↓ |
68 lines elided |
↑ open up ↑ |
468 440
469 441 .sp
470 442 .ne 2
471 443 .na
472 444 \fB\fB%Z\fR\fR
473 445 .ad
474 446 .RS 6n
475 447 Time zone name or abbreviation, or no bytes if no time zone information exists.
476 448 .RE
477 449
450 +.sp
451 +.ne 2
452 +.na
453 +\fB\fB%+\fR\fR
454 +.ad
455 +.RS 6n
456 +Locale's date and time representation as produced by \fBdate\fR(1).
457 +.RE
458 +
478 459 .sp
479 460 .LP
480 461 If a conversion specification does not correspond to any of the above or to any
481 462 of the modified conversion specifications listed below, the behavior is
482 463 undefined and \fB0\fR is returned.
483 464 .sp
484 465 .LP
485 466 The difference between \fB%U\fR and \fB%W\fR (and also between modified
486 467 conversion specifications \fB%OU\fR and \fB%OW\fR) lies in which day is counted
487 468 as the first of the week. Week number 1 is the first week in January starting
488 469 with a Sunday for \fB%U\fR or a Monday for \fB%W\fR. Week number 0 contains
489 470 those days before the first Sunday or Monday in January for \fB%U\fR and
490 471 \fB%W\fR, respectively.
491 472 .SS "Modified Conversion Specifications"
492 473 .sp
493 474 .LP
494 475 Some conversion specifications can be modified by the \fBE\fR and \fBO\fR
495 476 modifiers to indicate that an alternate format or specification should be used
496 477 rather than the one normally used by the unmodified conversion specification.
497 478 If the alternate format or specification does not exist in the current locale,
498 479 the behavior will be as if the unmodified specification were used.
499 480 .sp
500 481 .ne 2
501 482 .na
502 483 \fB\fB%Ec\fR\fR
503 484 .ad
504 485 .RS 7n
505 486 Locale's alternate appropriate date and time representation.
506 487 .RE
507 488
508 489 .sp
509 490 .ne 2
510 491 .na
511 492 \fB\fB%EC\fR\fR
512 493 .ad
513 494 .RS 7n
514 495 Name of the base year (period) in the locale's alternate representation.
515 496 .RE
516 497
517 498 .sp
518 499 .ne 2
519 500 .na
520 501 \fB\fB%Eg\fR\fR
521 502 .ad
522 503 .RS 7n
523 504 Offset from \fB%EC\fR of the week-based year in the locale's alternative
524 505 representation.
525 506 .RE
526 507
527 508 .sp
528 509 .ne 2
529 510 .na
530 511 \fB\fB%EG\fR\fR
531 512 .ad
532 513 .RS 7n
533 514 Full alternative representation of the week-based year.
534 515 .RE
535 516
536 517 .sp
537 518 .ne 2
538 519 .na
539 520 \fB\fB%Ex\fR\fR
540 521 .ad
541 522 .RS 7n
542 523 Locale's alternate date representation.
543 524 .RE
544 525
545 526 .sp
546 527 .ne 2
547 528 .na
548 529 \fB\fB%EX\fR\fR
549 530 .ad
550 531 .RS 7n
551 532 Locale's alternate time representation.
552 533 .RE
553 534
554 535 .sp
555 536 .ne 2
556 537 .na
557 538 \fB\fB%Ey\fR\fR
558 539 .ad
559 540 .RS 7n
560 541 Offset from \fB%EC\fR (year only) in the locale's alternate representation.
561 542 .RE
562 543
563 544 .sp
564 545 .ne 2
565 546 .na
566 547 \fB\fB%EY\fR\fR
567 548 .ad
568 549 .RS 7n
569 550 Full alternate year representation.
570 551 .RE
571 552
572 553 .sp
573 554 .ne 2
574 555 .na
575 556 \fB\fB%Od\fR\fR
576 557 .ad
577 558 .RS 7n
578 559 Day of the month using the locale's alternate numeric symbols.
579 560 .RE
580 561
581 562 .sp
582 563 .ne 2
583 564 .na
584 565 \fB\fB%Oe\fR\fR
585 566 .ad
586 567 .RS 7n
587 568 Same as \fB%Od\fR.
588 569 .RE
589 570
590 571 .sp
591 572 .ne 2
592 573 .na
593 574 \fB\fB%Og\fR\fR
594 575 .ad
595 576 .RS 7n
596 577 Week-based year (offset from \fB%C\fR) in the locale's alternate representation
597 578 and using the locale's alternate numeric symbols.
598 579 .RE
599 580
600 581 .sp
601 582 .ne 2
602 583 .na
603 584 \fB\fB%OH\fR\fR
604 585 .ad
605 586 .RS 7n
606 587 Hour (24-hour clock) using the locale's alternate numeric symbols.
607 588 .RE
608 589
609 590 .sp
610 591 .ne 2
611 592 .na
612 593 \fB\fB%OI\fR\fR
613 594 .ad
614 595 .RS 7n
615 596 Hour (12-hour clock) using the locale's alternate numeric symbols.
616 597 .RE
617 598
618 599 .sp
619 600 .ne 2
620 601 .na
621 602 \fB\fB%Om\fR\fR
622 603 .ad
623 604 .RS 7n
624 605 Month using the locale's alternate numeric symbols.
625 606 .RE
626 607
627 608 .sp
628 609 .ne 2
629 610 .na
630 611 \fB\fB%OM\fR\fR
631 612 .ad
632 613 .RS 7n
633 614 Minutes using the locale's alternate numeric symbols.
634 615 .RE
635 616
636 617 .sp
637 618 .ne 2
638 619 .na
639 620 \fB\fB%OS\fR\fR
640 621 .ad
641 622 .RS 7n
642 623 Seconds using the locale's alternate numeric symbols.
643 624 .RE
644 625
645 626 .sp
646 627 .ne 2
647 628 .na
648 629 \fB\fB%Ou\fR\fR
649 630 .ad
650 631 .RS 7n
651 632 Weekday as a number in the locale's alternate numeric symbols.
652 633 .RE
653 634
654 635 .sp
655 636 .ne 2
656 637 .na
657 638 \fB\fB%OU\fR\fR
658 639 .ad
659 640 .RS 7n
660 641 Week number of the year (Sunday as the first day of the week) using the
661 642 locale's alternate numeric symbols.
662 643 .RE
663 644
664 645 .sp
665 646 .ne 2
666 647 .na
667 648 \fB\fB%Ow\fR\fR
668 649 .ad
669 650 .RS 7n
670 651 Number of the weekday (Sunday=0) using the locale's alternate numeric symbols.
671 652 .RE
672 653
673 654 .sp
674 655 .ne 2
675 656 .na
676 657 \fB\fB%OW\fR\fR
677 658 .ad
678 659 .RS 7n
679 660 Week number of the year (Monday as the first day of the week) using the
680 661 locale's alternate numeric symbols.
681 662 .RE
682 663
683 664 .sp
684 665 .ne 2
685 666 .na
686 667 \fB\fB%Oy\fR\fR
687 668 .ad
688 669 .RS 7n
689 670 Year (offset from \fB%C\fR) in the locale's alternate representation and using
690 671 the locale's alternate numeric symbols.
691 672 .RE
692 673
693 674 .SS "Selecting the Output Language"
694 675 .sp
695 676 .LP
696 677 By default, the output of \fBstrftime()\fR, \fBcftime()\fR, and
697 678 \fBascftime()\fR appear in U.S. English. The user can request that the output
698 679 of \fBstrftime()\fR, \fBcftime()\fR, or \fBascftime()\fR be in a specific
699 680 language by setting the \fBLC_TIME\fR category using \fBsetlocale()\fR.
700 681 .SS "Time Zone"
701 682 .sp
702 683 .LP
703 684 Local time zone information is used as though \fBtzset\fR(3C) were called.
704 685 .SH RETURN VALUES
705 686 .sp
706 687 .LP
707 688 The \fBstrftime()\fR, \fBcftime()\fR, and \fBascftime()\fR functions return the
708 689 number of characters placed into the array pointed to by \fIs\fR, not including
709 690 the terminating null character. If the total number of resulting characters
710 691 including the terminating null character is more than \fImaxsize\fR,
711 692 \fBstrftime()\fR returns \fB0\fR and the contents of the array are
712 693 indeterminate.
713 694 .SH EXAMPLES
714 695 .LP
715 696 \fBExample 1 \fRAn example of the \fBstrftime()\fR function.
716 697 .sp
717 698 .LP
718 699 The following example illustrates the use of \fBstrftime()\fR for the
719 700 \fBPOSIX\fR locale. It shows what the string in \fIstr\fR would look like if
720 701 the structure pointed to by \fItmptr\fR contains the values corresponding to
721 702 Thursday, August 28, 1986 at 12:44:36.
722 703
723 704 .sp
724 705 .in +2
725 706 .nf
726 707 \fBstrftime (str, strsize, "%A %b %d %j", tmptr)\fR
727 708 .fi
728 709 .in -2
729 710
730 711 .sp
731 712 .LP
732 713 This results in \fIstr\fR containing "Thursday Aug 28 240".
733 714
734 715 .SH ATTRIBUTES
735 716 .sp
736 717 .LP
737 718 See \fBattributes\fR(5) for descriptions of the following attributes:
738 719 .sp
739 720
740 721 .sp
741 722 .TS
742 723 box;
743 724 c | c
744 725 l | l .
745 726 ATTRIBUTE TYPE ATTRIBUTE VALUE
746 727 _
747 728 CSI Enabled
748 729 _
749 730 Interface Stability Committed
750 731 _
751 732 MT-Level MT-Safe
752 733 _
753 734 Standard See below.
754 735 .TE
755 736
756 737 .sp
757 738 .LP
758 739 For \fBstrftime()\fR, see \fBstandards\fR(5).
759 740 .SH SEE ALSO
760 741 .sp
761 742 .LP
762 743 \fBdate\fR(1), \fBctime\fR(3C), \fBmktime\fR(3C), \fBsetlocale\fR(3C),
763 744 \fBstrptime\fR(3C), \fBtzset\fR(3C), \fBTIMEZONE\fR(4), \fBzoneinfo\fR(4),
764 745 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
765 746 .SH NOTES
766 747 .sp
767 748 .LP
768 749 The conversion specification for \fB%V\fR was changed in the Solaris 7 release.
769 750 This change was based on the public review draft of the ISO C9x standard at
770 751 that time. Previously, the specification stated that if the week containing 1
771 752 January had fewer than four days in the new year, it became week 53 of the
772 753 previous year. The ISO C9x standard committee subsequently recognized that that
773 754 specification had been incorrect.
774 755 .sp
775 756 .LP
776 757 The conversion specifications for \fB%g\fR, \fB%G\fR, \fB%Eg\fR, \fB%EG\fR, and
777 758 \fB%Og\fR were added in the Solaris 7 release. This change was based on the
778 759 public review draft of the ISO C9x standard at that time. These specifications
779 760 are evolving. If the ISO C9x standard is finalized with a different
780 761 conclusion, these specifications will change to conform to the ISO C9x standard
781 762 decision.
782 763 .sp
783 764 .LP
784 765 The conversion specification for \fB%u\fR was changed in the Solaris 8 release.
785 766 This change was based on the XPG4 specification.
786 767 .sp
787 768 .LP
788 769 If using the \fB%Z\fR specifier and \fBzoneinfo\fR timezones and if the input
789 770 date is outside the range 20:45:52 UTC, December 13, 1901 to 03:14:07 UTC,
790 771 January 19, 2038, the timezone name may not be correct.
↓ open down ↓ |
303 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX