1STRFTIME(3P)               POSIX Programmer's Manual              STRFTIME(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       strftime, strftime_l — convert date and time to a string
14

SYNOPSIS

16       #include <time.h>
17
18       size_t strftime(char *restrict s, size_t maxsize,
19           const char *restrict format, const struct tm *restrict timeptr);
20       size_t strftime_l(char *restrict s, size_t maxsize,
21           const char *restrict format, const struct tm *restrict timeptr,
22           locale_t locale);
23

DESCRIPTION

25       For strftime(): The functionality described on this reference  page  is
26       aligned  with the ISO C standard. Any conflict between the requirements
27       described here and the ISO C standard is unintentional. This volume  of
28       POSIX.1‐2008 defers to the ISO C standard.
29
30       The  strftime() function shall place bytes into the array pointed to by
31       s as controlled by the string pointed to by format.  The  format  is  a
32       character  string,  beginning and ending in its initial shift state, if
33       any. The format string consists of zero or more  conversion  specifica‐
34       tions and ordinary characters.
35
36       Each  conversion specification is introduced by the '%' character after
37       which the following appear in sequence:
38
39        *  An optional flag:
40
41           0     The zero character ('0'), which specifies that the  character
42                 used as the padding character is '0',
43
44           +     The  <plus-sign>  character  ('+'),  which specifies that the
45                 character used as the padding character is '0', and  that  if
46                 and  only if the field being produced consumes more than four
47                 bytes to represent a year (for %F, %G, or %Y)  or  more  than
48                 two  bytes to represent the year divided by 100 (for %C) then
49                 a leading <plus-sign> character shall be included if the year
50                 being processed is greater than or equal to zero or a leading
51                 minus-sign character ('−') shall be included if the  year  is
52                 less than zero.
53
54           The default padding character is unspecified.
55
56        *  An  optional minimum field width. If the converted value, including
57           any leading '+' or '−' sign, has fewer bytes than the minimum field
58           width  and the padding character is not the NUL character, the out‐
59           put shall be padded on the left (after any leading '+' or '−' sign)
60           with the padding character.
61
62        *  An optional E or O modifier.
63
64        *  A  terminating  conversion  specifier  character that indicates the
65           type of conversion to be applied.
66
67       The results are unspecified if more than one flag character  is  speci‐
68       fied,  a  flag  character is specified without a minimum field width; a
69       minimum field width is specified without a flag character;  a  modifier
70       is specified with a flag or with a minimum field width; or if a minimum
71       field width is specified for any conversion specifier other than C,  F,
72       G, or Y.
73
74       All  ordinary  characters (including the terminating NUL character) are
75       copied unchanged into the array. If copying takes place between objects
76       that overlap, the behavior is undefined. No more than maxsize bytes are
77       placed into the array. Each conversion specifier is replaced by  appro‐
78       priate  characters  as described in the following list. The appropriate
79       characters are determined using the LC_TIME  category  of  the  current
80       locale  and  by  the  values of zero or more members of the broken-down
81       time structure pointed to by timeptr, as specified in brackets  in  the
82       description.  If  any  of  the  specified values are outside the normal
83       range, the characters stored are unspecified.
84
85       The strftime_l() function shall be equivalent to the  strftime()  func‐
86       tion,  except  that the locale data used is from the locale represented
87       by locale.
88
89       Local timezone information is used as though strftime() called tzset().
90
91       The following conversion specifiers shall be supported:
92
93       a       Replaced by the locale's abbreviated weekday name. [tm_wday]
94
95       A       Replaced by the locale's full weekday name. [tm_wday]
96
97       b       Replaced by the locale's abbreviated month name. [tm_mon]
98
99       B       Replaced by the locale's full month name. [tm_mon]
100
101       c       Replaced by the locale's appropriate date and time  representa‐
102               tion.   (See  the  Base  Definitions  volume  of  POSIX.1‐2008,
103               <time.h>.)
104
105       C       Replaced by the year divided by 100 and truncated to  an  inte‐
106               ger, as a decimal number. [tm_year]
107
108               If  a minimum field width is not specified, the number of char‐
109               acters placed into the array pointed to by s will be the number
110               of  digits  in  the  year  divided  by 100 or two, whichever is
111               greater.  If a minimum field width is specified, the number  of
112               characters  placed  into  the array pointed to by s will be the
113               number of digits in the year divided  by  100  or  the  minimum
114               field width, whichever is greater.
115
116       d       Replaced  by  the day of the month as a decimal number [01,31].
117               [tm_mday]
118
119       D       Equivalent to %m/%d/%y.  [tm_mon, tm_mday, tm_year]
120
121       e       Replaced by the day of the month as a decimal number [1,31];  a
122               single digit is preceded by a space. [tm_mday]
123
124       F       Equivalent  to %+4Y-%m-%d if no flag and no minimum field width
125               are specified. [tm_year, tm_mon, tm_mday]
126
127               If a minimum field width of x is specified, the year  shall  be
128               output as if by the Y specifier (described below) with whatever
129               flag was given and a minimum field width of x−6.  If x is  less
130               than 6, the behavior shall be as if x equalled 6.
131
132               If  the minimum field width is specified to be 10, and the year
133               is four digits long, then the output string produced will match
134               the ISO 8601:2004 standard subclause 4.1.2.2 complete represen‐
135               tation, extended format date representation of a specific  day.
136               If  a + flag is specified, a minimum field width of x is speci‐
137               fied, and x−7 bytes are sufficient to hold the  digits  of  the
138               year (not including any needed sign character), then the output
139               will match the ISO 8601:2004 standard  subclause  4.1.2.4  com‐
140               plete  representation, expanded format date representation of a
141               specific day.
142
143       g       Replaced by the last 2  digits  of  the  week-based  year  (see
144               below) as a decimal number [00,99]. [tm_year, tm_wday, tm_yday]
145
146       G       Replaced by the week-based year (see below) as a decimal number
147               (for example, 1977). [tm_year, tm_wday, tm_yday]
148
149               If a minimum field width is specified, the number of characters
150               placed  into  the  array  pointed to by s will be the number of
151               digits and leading sign characters (if any) in the year, or the
152               minimum field width, whichever is greater.
153
154       h       Equivalent to %b.  [tm_mon]
155
156       H       Replaced  by  the  hour  (24-hour  clock)  as  a decimal number
157               [00,23]. [tm_hour]
158
159       I       Replaced by the  hour  (12-hour  clock)  as  a  decimal  number
160               [01,12]. [tm_hour]
161
162       j       Replaced  by the day of the year as a decimal number [001,366].
163               [tm_yday]
164
165       m       Replaced by the month as a decimal number [01,12]. [tm_mon]
166
167       M       Replaced by the minute as a decimal number [00,59]. [tm_min]
168
169       n       Replaced by a <newline>.
170
171       p       Replaced by the locale's equivalent  of  either  a.m.  or  p.m.
172               [tm_hour]
173
174       r       Replaced  by  the  time in a.m. and p.m. notation; in the POSIX
175               locale this shall be  equivalent  to  %I:%M:%S  %p.   [tm_hour,
176               tm_min, tm_sec]
177
178       R       Replaced  by  the  time in 24-hour notation (%H:%M).  [tm_hour,
179               tm_min]
180
181       S       Replaced by the second as a decimal number [00,60]. [tm_sec]
182
183       t       Replaced by a <tab>.
184
185       T       Replaced by the time (%H:%M:%S).  [tm_hour, tm_min, tm_sec]
186
187       u       Replaced by the weekday as a decimal number [1,7], with 1  rep‐
188               resenting Monday. [tm_wday]
189
190       U       Replaced  by  the  week  number of the year as a decimal number
191               [00,53].  The first Sunday of January is the first day of  week
192               1;  days  in  the new year before this are in week 0. [tm_year,
193               tm_wday, tm_yday]
194
195       V       Replaced by the week number of the year (Monday  as  the  first
196               day  of the week) as a decimal number [01,53]. If the week con‐
197               taining 1 January has four or more days in the new  year,  then
198               it is considered week 1.  Otherwise, it is the last week of the
199               previous year, and the next week is week 1.  Both  January  4th
200               and  the  first  Thursday  of  January  are  always  in week 1.
201               [tm_year, tm_wday, tm_yday]
202
203       w       Replaced by the weekday as a decimal number [0,6], with 0  rep‐
204               resenting Sunday. [tm_wday]
205
206       W       Replaced  by  the  week  number of the year as a decimal number
207               [00,53].  The first Monday of January is the first day of  week
208               1;  days  in  the new year before this are in week 0. [tm_year,
209               tm_wday, tm_yday]
210
211       x       Replaced by the locale's appropriate date representation.  (See
212               the Base Definitions volume of POSIX.1‐2008, <time.h>.)
213
214       X       Replaced  by the locale's appropriate time representation. (See
215               the Base Definitions volume of POSIX.1‐2008, <time.h>.)
216
217       y       Replaced by the last two digits of the year as a decimal number
218               [00,99]. [tm_year]
219
220       Y       Replaced  by  the year as a decimal number (for example, 1997).
221               [tm_year]
222
223               If a minimum field width is specified, the number of characters
224               placed  into  the  array  pointed to by s will be the number of
225               digits and leading sign characters (if any) in the year, or the
226               minimum field width, whichever is greater.
227
228       z       Replaced  by  the offset from UTC in the ISO 8601:2004 standard
229               format (+hhmm or −hhmm), or by no characters if no timezone  is
230               determinable.  For  example,  "−0430"  means 4 hours 30 minutes
231               behind UTC (west of Greenwich).  If tm_isdst is zero, the stan‐
232               dard time offset is used. If tm_isdst is greater than zero, the
233               daylight savings time offset is used. If tm_isdst is  negative,
234               no characters are returned.  [tm_isdst]
235
236       Z       Replaced  by  the timezone name or abbreviation, or by no bytes
237               if no timezone information exists. [tm_isdst]
238
239       %       Replaced by %.
240
241       If a conversion specification does not correspond to any of the  above,
242       the behavior is undefined.
243
244       If  a struct tm broken-down time structure is created by localtime() or
245       localtime_r(), or modified by mktime(), and the value of TZ  is  subse‐
246       quently  modified,  the  results of the %Z and %z strftime() conversion
247       specifiers are undefined, when strftime() is called with such a broken-
248       down time structure.
249
250       If  a  struct  tm  broken-down time structure is created or modified by
251       gmtime() or gmtime_r(), it is unspecified whether the result of the  %Z
252       and  %z  conversion  specifiers shall refer to UTC or the current local
253       timezone, when strftime() is called with such a broken-down time struc‐
254       ture.
255
256   Modified Conversion Specifiers
257       Some conversion specifiers can be modified by the E or O modifier char‐
258       acters to indicate that an alternative format or  specification  should
259       be  used rather than the one normally used by the unmodified conversion
260       specifier. If the alternative format or specification  does  not  exist
261       for  the  current  locale  (see  ERA  in the Base Definitions volume of
262       POSIX.1‐2008, Section 7.3.5, LC_TIME), the behavior shall be as if  the
263       unmodified conversion specification were used.
264
265       %Ec     Replaced  by the locale's alternative appropriate date and time
266               representation.
267
268       %EC     Replaced by the name of the base year (period) in the  locale's
269               alternative representation.
270
271       %Ex     Replaced by the locale's alternative date representation.
272
273       %EX     Replaced by the locale's alternative time representation.
274
275       %Ey     Replaced  by  the  offset  from %EC (year only) in the locale's
276               alternative representation.
277
278       %EY     Replaced by the full alternative year representation.
279
280       %Od     Replaced by the day of the month, using the  locale's  alterna‐
281               tive  numeric  symbols,  filled as needed with leading zeros if
282               there is any alternative symbol for zero; otherwise, with lead‐
283               ing <space> characters.
284
285       %Oe     Replaced  by  the day of the month, using the locale's alterna‐
286               tive numeric symbols, filled as  needed  with  leading  <space>
287               characters.
288
289       %OH     Replaced  by the hour (24-hour clock) using the locale's alter‐
290               native numeric symbols.
291
292       %OI     Replaced by the hour (12-hour clock) using the locale's  alter‐
293               native numeric symbols.
294
295       %Om     Replaced  by  the  month using the locale's alternative numeric
296               symbols.
297
298       %OM     Replaced by the minutes using the locale's alternative  numeric
299               symbols.
300
301       %OS     Replaced  by the seconds using the locale's alternative numeric
302               symbols.
303
304       %Ou     Replaced by the weekday as a number in the locale's alternative
305               representation (Monday=1).
306
307       %OU     Replaced  by  the  week number of the year (Sunday as the first
308               day of the week, rules corresponding to %U) using the  locale's
309               alternative numeric symbols.
310
311       %OV     Replaced  by  the  week number of the year (Monday as the first
312               day of the week, rules corresponding to %V) using the  locale's
313               alternative numeric symbols.
314
315       %Ow     Replaced  by  the  number  of  the weekday (Sunday=0) using the
316               locale's alternative numeric symbols.
317
318       %OW     Replaced by the week number of the year (Monday  as  the  first
319               day  of  the  week) using the locale's alternative numeric sym‐
320               bols.
321
322       %Oy     Replaced by the year (offset from %C) using the locale's alter‐
323               native numeric symbols.
324
325       %g,  %G,  and  %V  give  values according to the ISO 8601:2004 standard
326       week-based year. In this system, weeks begin on a Monday and week 1  of
327       the  year is the week that includes January 4th, which is also the week
328       that includes the first Thursday of the year, and  is  also  the  first
329       week  that contains at least four days in the year. If the first Monday
330       of January is the 2nd, 3rd, or 4th, the preceding days are part of  the
331       last  week  of the preceding year; thus, for Saturday 2nd January 1999,
332       %G is replaced by 1998 and %V is replaced  by  53.  If  December  29th,
333       30th, or 31st is a Monday, it and any following days are part of week 1
334       of the following year. Thus, for Tuesday  30th  December  1997,  %G  is
335       replaced by 1998 and %V is replaced by 01.
336
337       If  a  conversion  specifier  is  not one of the above, the behavior is
338       undefined.
339
340       The behavior is undefined if the locale argument to strftime_l() is the
341       special  locale object LC_GLOBAL_LOCALE or is not a valid locale object
342       handle.
343

RETURN VALUE

345       If the total number of resulting bytes including the  terminating  null
346       byte  is not more than maxsize, these functions shall return the number
347       of bytes placed into the array pointed to by s, not including the  ter‐
348       minating NUL character. Otherwise, 0 shall be returned and the contents
349       of the array are unspecified.
350

ERRORS

352       No errors are defined.
353
354       The following sections are informative.
355

EXAMPLES

357   Getting a Localized Date String
358       The following example first sets the locale to the user's default.  The
359       locale  information  will  be  used in the nl_langinfo() and strftime()
360       functions. The nl_langinfo() function returns the localized date string
361       which specifies how the date is laid out. The strftime() function takes
362       this information and, using the tm structure  for  values,  places  the
363       date and time information into datestring.
364
365           #include <time.h>
366           #include <locale.h>
367           #include <langinfo.h>
368           ...
369           struct tm *tm;
370           char datestring[256];
371           ...
372           setlocale (LC_ALL, "");
373           ...
374           strftime (datestring, sizeof(datestring), nl_langinfo (D_T_FMT), tm);
375           ...
376

APPLICATION USAGE

378       The  range of values for %S is [00,60] rather than [00,59] to allow for
379       the occasional leap second.
380
381       Some of the conversion specifications are duplicates  of  others.  They
382       are  included  for  compatibility  with  nl_cxtime() and nl_ascxtime(),
383       which were published in Issue 2.
384
385       The %C, %F, %G, and %Y format specifiers  in  strftime()  always  print
386       full  values,  but the strptime() %C, %F, and %Y format specifiers only
387       scan two digits (assumed to be the first two  digits  of  a  four-digit
388       year)  for  %C  and  four digits (assumed to be the entire (four-digit)
389       year) for %F and %Y.  This mimics the behavior of printf() and scanf();
390       that is:
391
392           printf("%2d", x = 1000);
393
394       prints "1000", but:
395
396           scanf(%2d", &x);
397
398       when  given  "1000"  as  input  will only store 10 in x).  Applications
399       using extended ranges of years must be sure that the number  of  digits
400       specified for scanning years with strptime() matches the number of dig‐
401       its that will actually be present in the input stream. Historic  imple‐
402       mentations  of  the  %Y  conversion specification (with no flags and no
403       minimum field width) produced different  output  formats.  Some  always
404       produced  at  least  four  digits (with 0 fill for years from 0 through
405       999) while others only produced the number of  digits  present  in  the
406       year  (with  no  fill  and no padding). These two forms can be produced
407       with the '0' flag and a minimum field width options using  the  conver‐
408       sions specifications %04Y and %01Y, respectively.
409
410       In  the  past,  the C and POSIX standards specified that %F produced an
411       ISO 8601:2004 standard date format, but didn't specify which  one.  For
412       years  in  the range [0001,9999], POSIX.1‐2008 requires that the output
413       produced  match  the  ISO 8601:2004  standard  complete  representation
414       extended  format  (YYYY-MM-DD) and for years outside of this range pro‐
415       duce output that matches the ISO 8601:2004 standard expanded  represen‐
416       tation  extended  format  (<+/-><Underline>Y</Underline>YYYY-MM-DD). To
417       fully meet ISO 8601:2004 standard requirements, the producer  and  con‐
418       sumer  must  agree on a date format that has a specific number of bytes
419       reserved to hold the characters used to represent  the  years  that  is
420       sufficiently large to hold all values that will be shared. For example,
421       the %+13F conversion specification will  produce  output  matching  the
422       format  "<+/->YYYYYY-MM-DD"  (a  leading  '+' or '−' sign; a six-digit,
423       0-filled year; a '−'; a two-digit, leading 0-filled month; another '−';
424       and the two-digit, leading 0-filled day within the month).
425
426       Note that if the year being printed is greater than 9999, the resulting
427       string from the unadorned %F conversion specifications will not conform
428       to  the ISO 8601:2004 standard extended format, complete representation
429       for a date and will instead be an extended format, expanded representa‐
430       tion (presumably without the required agreement between the date's pro‐
431       ducer and consumer).
432
433       In the C locale, the E and O modifiers are ignored and the  replacement
434       strings for the following specifiers are:
435
436       %a      The first three characters of %A.
437
438       %A      One of Sunday, Monday, ..., Saturday.
439
440       %b      The first three characters of %B.
441
442       %B      One of January, February, ..., December.
443
444       %c      Equivalent to %a %b %e %T %Y.
445
446       %p      One of AM or PM.
447
448       %r      Equivalent to %I:%M:%S %p.
449
450       %x      Equivalent to %m/%d/%y.
451
452       %X      Equivalent to %T.
453
454       %Z      Implementation-defined.
455

RATIONALE

457       The %Y conversion specification to strftime() was frequently assumed to
458       be a four-digit year, but the ISO C standard does not specify  that  %Y
459       is  restricted  to any subset of allowed values from the tm_year field.
460       Similarly, the %C conversion specification was assumed  to  be  a  two-
461       digit  field  and  the  first part of the output from the %F conversion
462       specification was assumed to be a four-digit field. With tm_year  being
463       a  signed 32 or more-bit int and with many current implementations sup‐
464       porting 64-bit time_t types in one or  more  programming  environments,
465       these assumptions are clearly wrong.
466
467       POSIX.1‐2008 now allows the format specifications %0xC, %0xF, %0xG, and
468       %0xY (where 'x' is a string of decimal digits used to specify  printing
469       and  scanning  of  a string of x decimal digits) with leading zero fill
470       characters. Allowing applications to set the field width  enables  them
471       to  agree  on  the  number  of  digits to be printed and scanned in the
472       ISO 8601:2004 standard expanded representation of a year (for  %F,  %G,
473       and  %Y)  or all but the last two digits of the year (for %C).  This is
474       based on a feature in some versions of GNU libc's strftime().  The  GNU
475       version  allows  specifying space, zero, or no-fill characters in strf‐
476       time() format strings, but does not allow any flags to be specified  in
477       strptime() format strings. These implementations also allow these flags
478       to be specified for any numeric field. POSIX.1‐2008 only  requires  the
479       zero  fill flag ('0') and only requires that it be recognized when pro‐
480       cessing %C, %F, %G, and %Y specifications when a minimum field width is
481       also  specified.  The  '0'  flag is the only flag needed to produce and
482       scan the ISO 8601:2004 standard year fields using the  extended  format
483       forms.  POSIX.1‐2008  also allows applications to specify the same flag
484       and field width specifiers to be used in both strftime() and strptime()
485       format  strings for symmetry. Systems may provide other flag characters
486       and may accept flags in conjunction with  conversion  specifiers  other
487       than  %C,  %F,  %G,  and %Y; but portable applications cannot depend on
488       such extensions.
489
490       POSIX.1‐2008 now also allows  the  format  specifications  %+xC,  %+xF,
491       %+xG, and %+xY (where 'x' is a string of decimal digits used to specify
492       printing and scanning of a string of 'x' decimal digits)  with  leading
493       zero fill characters and a leading '+' sign character if the year being
494       converted is more than four digits or a minimum field width  is  speci‐
495       fied  that  allows  room  for  more than four digits for the year. This
496       allows date providers and consumers to agree on a  specific  number  of
497       digits  to  represent  a year as required by the ISO 8601:2004 standard
498       expanded representation formats. The  expanded  representation  formats
499       all  require the year to begin with a leading '+' or '−' sign.  (All of
500       these specifiers can also provide  a  leading  '−'  sign  for  negative
501       years. Since negative years and the year 0 don't fit well with the Gre‐
502       gorian or Julian calendars, the normal ranges of dates start with  year
503       1.  The ISO C standard allows tm_year to assume values corresponding to
504       years before year 1, but the use of  such  years  provided  unspecified
505       results.)
506
507       Some earlier version of this standard specified that applications want‐
508       ing to use strptime() to scan dates and  times  printed  by  strftime()
509       should  provide  non-digit  characters between fields to separate years
510       from months and days. It also  supported  %F  to  print  and  scan  the
511       ISO 8601:2004  standard  extended  format, complete representation date
512       for years 1 through 9999 (i.e., YYYY-MM-DD). However, many applications
513       were  written  to  print (using strftime()) and scan (using strptime())
514       dates written using the basic  format  complete  representation  (four-
515       digit  years)  and truncated representation (two-digit years) specified
516       by the ISO 8601:2004 standard representation of dates and  times  which
517       do not have any separation characters between fields. The ISO 8601:2004
518       standard also specifies basic format expanded representation where  the
519       creator  and  consumer  of  these  fields agree beforehand to represent
520       years as leading zero-filled strings of an agreed length of  more  than
521       four  digits  to  represent a year (again with no separation characters
522       when year, month, and day are all  displayed).  Applications  producing
523       and  consuming  expanded  representations are encouraged to use the '+'
524       flag and an appropriate maximum field width to scan the year  including
525       the  leading sign. Note that even without the '+' flag, years less than
526       zero may be represented with a leading minus-sign  for  %F,  %G,and  %Y
527       conversion  specifications. Using negative years results in unspecified
528       behavior.
529
530       If a format specification %+xF with the field width x greater  than  11
531       is  specified  and  the width is large enough to display the full year,
532       the output string produced will match the ISO 8601:2004  standard  sub‐
533       clause  4.1.2.4 expanded representation, extended format date represen‐
534       tation for a specific day. (For years in the range [1,99999], %+12F  is
535       sufficient  for an agreed five-digit year with a leading sign using the
536       ISO 8601:2004 standard expanded representation, extended format  for  a
537       specific day "<+/->YYYYY-MM-DD".)  Note also that years less than 0 may
538       produce a leading minus-sign ('−') when using %Y or %C whether  or  not
539       the '0' or '+' flags are used.
540
541       The  difference  between  the  '0' flag and the '+' flag is whether the
542       leading '+' character will be provided for years >9999 as required  for
543       the  ISO 8601:2004 standard extended representation format containing a
544       year. For example:
545
546           ┌───────┬──────────────────────────┬─────────────┬────────────┐
547           │       │                          │ strftime()  strptime() 
548Year  Conversion Specification Output    Scan Back  
549           ├───────┼──────────────────────────┼─────────────┼────────────┤
550           │1970   │ %Y                       │ 1970        │ 1970       │
551           ├───────┼──────────────────────────┼─────────────┼────────────┤
552           │1970   │ %+4Y                     │ 1970        │ 1970       │
553           ├───────┼──────────────────────────┼─────────────┼────────────┤
554           │27     │ %Y                       │ 27 or 0027  │ 27         │
555           ├───────┼──────────────────────────┼─────────────┼────────────┤
556           │270    │ %Y                       │ 270 or 0270 │ 270        │
557           ├───────┼──────────────────────────┼─────────────┼────────────┤
558           │270    │ %+4Y                     │ 0270        │ 270        │
559           ├───────┼──────────────────────────┼─────────────┼────────────┤
560           │17     │ %C%y                     │ 0017        │ 17         │
561           ├───────┼──────────────────────────┼─────────────┼────────────┤
562           │270    │ %C%y                     │ 0270        │ 270        │
563           ├───────┼──────────────────────────┼─────────────┼────────────┤
564           │12345  │ %Y                       │ 12345       │ 1234*      │
565           ├───────┼──────────────────────────┼─────────────┼────────────┤
566           │12345  │ %+4Y                     │ +12345      │ 123*       │
567           ├───────┼──────────────────────────┼─────────────┼────────────┤
568           │12345  │ %05Y                     │ 12345       │ 12345      │
569           ├───────┼──────────────────────────┼─────────────┼────────────┤
570           │270    │ %+5Y or %+3C%y           │ +0270       │ 270        │
571           ├───────┼──────────────────────────┼─────────────┼────────────┤
572           │12345  │ %+5Y or %+3C%y           │ +12345      │ 1234*      │
573           ├───────┼──────────────────────────┼─────────────┼────────────┤
574           │12345  │ %06Y or %04C%y           │ 012345      │ 12345      │
575           ├───────┼──────────────────────────┼─────────────┼────────────┤
576           │12345  │ %+6Y or %+4C%y           │ +12345      │ 12345      │
577           ├───────┼──────────────────────────┼─────────────┼────────────┤
578           │123456 │ %08Y or %06C%y           │ 00123456    │ 123456     │
579           ├───────┼──────────────────────────┼─────────────┼────────────┤
580           │123456 │ %+8Y or %+6C%y           │ +0123456    │ 123456     │
581           └───────┴──────────────────────────┴─────────────┴────────────┘
582       In the cases above marked with a * in the strptime() scan  back  field,
583       the implied or specified number of characters scanned by strptime() was
584       less than the number of characters output by strftime() using the  same
585       format;  so the remaining digits of the year were dropped when the out‐
586       put date produced by strftime() was scanned back in by strptime().
587

FUTURE DIRECTIONS

589       None.
590

SEE ALSO

592       asctime(), clock(), ctime(), difftime(),  getdate(),  gmtime(),  local‐
593       time(), mktime(), strptime(), time(), tzset(), uselocale(), utime()
594
595       The  Base  Definitions  volume of POSIX.1‐2008, Section 7.3.5, LC_TIME,
596       <time.h>
597
599       Portions of this text are reprinted and reproduced in  electronic  form
600       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
601       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
602       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
603       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
604       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
605       event of any discrepancy between this version and the original IEEE and
606       The  Open Group Standard, the original IEEE and The Open Group Standard
607       is the referee document. The original Standard can be  obtained  online
608       at http://www.unix.org/online.html .
609
610       Any  typographical  or  formatting  errors that appear in this page are
611       most likely to have been introduced during the conversion of the source
612       files  to  man page format. To report such errors, see https://www.ker
613       nel.org/doc/man-pages/reporting_bugs.html .
614
615
616
617IEEE/The Open Group                  2013                         STRFTIME(3P)
Impressum