3 strftime - format date and time
9 size_t strftime(buf, maxsize, format, timeptr)
13 const struct tm *timeptr
18 The strftime function formats the information from timeptr
19 into the buffer buf according to the string pointed to by
22 The format string consists of zero or more conversion
23 specifications and ordinary characters. All ordinary
24 characters are copied directly into the buffer. A
25 conversion specification consists of a percent sign and one
28 No more than maxsize characters are be placed into the
29 array. If the total number of resulting characters,
30 including the terminating null character, is not more than
31 maxsize, strftime returns the number of characters in the
32 array, not counting the terminating null. Otherwise, zero
35 Each conversion specification is replaced by the characters
36 as follows which are then copied into the buffer.
38 %A is replaced by the locale's full weekday name.
40 %a is replaced by the locale's abbreviated weekday name.
42 %B is replaced by the locale's full month name.
45 is replaced by the locale's abbreviated month name.
47 %C is replaced by the century (a year divided by 100 and
48 truncated to an integer) as a decimal number (00-99).
50 %c is replaced by the locale's appropriate date and time
53 %D is replaced by the date in the format %m/%d/%y.
55 %d is replaced by the day of the month as a decimal number
58 %e is replaced by the day of month as a decimal number
59 (1-31); single digits are preceded by a blank.
61 %F is replaced by the date in the format %Y-%m-%d.
63 %G is replaced by the ISO 8601 year with century as a
66 %g is replaced by the ISO 8601 year without century as a
67 decimal number (00-99).
69 %H is replaced by the hour (24-hour clock) as a decimal
72 %I is replaced by the hour (12-hour clock) as a decimal
75 %j is replaced by the day of the year as a decimal number
78 %k is replaced by the hour (24-hour clock) as a decimal
79 number (0-23); single digits are preceded by a blank.
81 %l is replaced by the hour (12-hour clock) as a decimal
82 number (1-12); single digits are preceded by a blank.
84 %M is replaced by the minute as a decimal number (00-59).
86 %m is replaced by the month as a decimal number (01-12).
88 %n is replaced by a newline.
90 %p is replaced by the locale's equivalent of either AM or
93 %R is replaced by the time in the format %H:%M.
95 %r is replaced by the locale's representation of 12-hour
96 clock time using AM/PM notation.
98 %S is replaced by the second as a decimal number (00-60).
100 %s is replaced by the number of seconds since the Epoch,
103 %T is replaced by the time in the format %H:%M:%S.
105 %t is replaced by a tab.
107 %U is replaced by the week number of the year (Sunday as
108 the first day of the week) as a decimal number (00-53).
110 %u is replaced by the weekday (Monday as the first day of
111 the week) as a decimal number (1-7).
113 %V is replaced by the week number of the year (Monday as
114 the first day of the week) as a decimal number (01-53).
115 If the week containing January 1 has four or more days
116 in the new year, then it is week 1; otherwise it is
117 week 53 of the previous year, and the next week is week
120 %W is replaced by the week number of the year (Monday as
121 the first day of the week) as a decimal number (00-53).
123 %w is replaced by the weekday (Sunday as the first day of
124 the week) as a decimal number (0-6).
126 %X is replaced by the locale's appropriate time
129 %x is replaced by the locale's appropriate date
132 %Y is replaced by the year with century as a decimal
135 %y is replaced by the year without century as a decimal
138 %Z is replaced by the time zone name, or by the empty
139 string if this is not determinable.
141 %z is replaced by the offset from UTC in the format +HHMM
142 or -HHMM as appropriate, with positive values
143 representing locations east of Greenwich, or by the
144 empty string if this is not determinable.
146 %% is replaced by a single %.
148 %+ is replaced by the date and time in date(1) format.
151 date(1), getenv(3), newctime(3), newtzset(3), time(2),