The strftime function uses data in the structure pointed to by timeptr to create the string pointed to by s. A maximum of maxsize bytes is copied to s. The format string consists of zero or more conversion specifications and ordinary characters. All ordinary characters (including the terminating null character) are copied unchanged into the output string. A conversion specification defines how data in the tm structure is formatted in the output string. A conversion specification consists of a percent (%) character followed by one or more optional characters (see Optional Elements of strftime Conversion Specifications), and concluding with a conversion specifier (see strftime Conversion Specifiers). If any of the optional characters listed in Optional Elements of strftime Conversion Specifications are specified, they must appear in the order shown in the table. The strftime function behaves as if it called tzset. Table REF-7 Optional Elements of strftime Conversion Specifications Element Meaning - Optional with the field width to specify that the field is left-justified and padded with spaces. This cannot be used with the 0 element. 0 Optional with the field width to specify that the field is right-justified and padded with zeros. This cannot be used with the - element. field A decimal integer that specifies the maximum field width width .precision A decimal integer that specifies the precision of data in a field. For the d, H, I, j, m, M, o, S, U, w, W, y, and Y conversion specifiers, the precision specifier is the minimum number of digits to appear in the field. If the conversion specification has fewer digits than that specified by the precision, leading zeros are added. For the a, A, b, B, c, D, E, h, n, N, p, r, t, T, x, X, Z, and % conversion specifiers, the precision specifier is the maximum number of characters to appear in the field. If the conversion specification has more characters than that specified by the precision, characters are truncated on the right. The default precision for the d, H, I, m, M, o, S, U, w, W, y and Y conversion specifiers is 2; the default precision for the j conversion specifier is 3. Note that the list of conversion specifications in Optional Elements of strftime Conversion Specifications are extensions to the XPG4 specification. strftime Conversion Specifiers lists the conversion specifiers. The strftime function uses fields in the LC_TIME category of the program's current locale to provide a value. For example, if %B is specified, the function accesses the mon field in LC_TIME to find the full month name for the month specified in the tm structure. The result of using invalid conversion specifiers is undefined. Table REF-8 strftime Conversion Specifiers Specifier Replaced by a The locale's abbreviated weekday name A The locale's full weekday name b The locale's abbreviated month name B The locale's full month name c The locale's appropriate date and time representation C The century number (the year divided by 100 and truncated to an integer) as a decimal number (00 - 99) d The day of the month as a decimal number (01 - 31) D Same as %m/%d/%y e The day of the month as a decimal number (1 - 31) in a 2-digit field with the leading space character fill Ec The locale's alternative date and time representation EC The name of the base year (period) in the locale's alternative representation Ex The locale's alternative date representation EX The locale's alternative time representation Ey The offset from the base year (%EC) in the locale's alternative representation EY The locale's full alternative year representation h Same as %b H The hour (24-hour clock) as a decimal number (00 - 23) I The hour (12-hour clock) as a decimal number (01 - 12) j The day of the year as a decimal number (001 - 366) m The month as a decimal number (01 - 12) M The minute as a decimal number (00 - 59) n The new-line character Od The day of the month using the locale's alternative numeric symbols Oe The date of the month using the locale's alternative numeric symbols OH The hour (24-hour clock) using the locale's alternative numeric symbols OI The hour (12-hour clock) using the locale's alternative numeric symbols Om The month using the locale's alternative numeric symbols OM The minutes using the locale's alternative numeric symbols OS The seconds using the locale's alternative numeric symbols Ou The weekday as a number in the locale's alternative representation (Monday=1) OU The week number of the year (Sunday as the first day of the week) using the locale's alternative numeric symbols OV The week number of the year (Monday as the first day of the week) as a decimal number (01 - 53) using the locale's alternative numeric symbols. If the week containing January 1 has four or more days in the new year, it is considered as week 1. Otherwise, it is considered as week 53 of the previous year, and the next week is week 1. Ow The weekday as a number (Sunday=0) using the locale's alternative numeric symbols OW The week number of the year (Monday as the first day of the week) using the locale's alternative numeric symbols Oy The year without the century using the locale's alternative numeric symbols p The locale's equivalent of the AM/PM designations associated with a 12-hour clock r The time in AM/PM notation R The time in 24-hour notation (%H:%M) S The second as a decimal number (00 - 61) t The tab character T The time (%H:%M:%S) u The weekday as a decimal number between 1 and 7 (Monday=1) U The week number of the year (the first Sunday as the first day of week 1) as a decimal number (00 - 53) V The week number of the year (Monday as the first day of the week) as a decimal number (00 - 53). If the week containing January 1 has four or more days in the new year, it is considered as week 1. Otherwise, it is considered as week 53 of the previous year, and the next week is week 1. w The weekday as a decimal number (0 [Sunday] - 6) W The week number of the year (the first Monday as the first day of week 1) as a decimal number (00 - 53) x The locale's appropriate date representation X The locale's appropriate time representation y The year without century as a decimal number (00 - 99) Y The year with century as a decimal number Z Time-zone name or abbreviation. If time-zone information is not available, no character is output. % Literal % character.