
You propose new conversion specifiers for strftime in C9x, the new C standard, in your document ISO/IEC JTC1/SC22/WG14 N733 <http://www.gold.net/users/cdwf/c/wg14n733.txt> (1997-07-01). Here are a couple of quotes from that document, followed by some suggestions for improvements. %f is replaced by the weekday as a decimal number (1-7), where Monday is 1 (the ISO 8601 weekday number). Please change this from %f to %u, because %u is current practice. I believe %u was introduced several years ago in Arnold Robbins's public domain strftime, and it is now the standard in many strftime implementations, including the Arthur David Olson public domain strftime <ftp://elsie.nci.nih.gov/pub/>, the GNU C library <ftp://prep.ai.mit.edu/pub/gnu/>, 4.4BSD (e.g. BSD/OS), Linux, and Solaris. %u is also required by POSIX.2's `date' command to have the same meaning (please see IEEE Std 1003.2-1992 section 4.15.4.1 page 241 line 2931); it would be odd for C9x to diverge unnecessarily from POSIX in this respect. %V is replaced by the ISO 8601 week number of the year %V does not suffice to support ISO 8601 week-oriented dates, because the ISO 8601 week's year may not be the same as the current year. For example, using ISO 8601 week notation, `1997-W01-2' denotes 1996-12-31 (as the first ISO week of 1997 begins on 1996-12-30). Similarly, `1998-W53-5' denotes 1999-01-01. If only %V is available, there's no easy way for a C program to output ISO-format dates like `1997-W01-2'. To work around this shortcoming, I propose that C9x add Robbins's %G and %g formats, as follows: %G is replaced by the year containing the ISO 8601 week %g is replaced by %G modulo 100 E.g. the format "%G-W%V-%u" outputs the ISO 8601 full week-oriented date, and the format "%gW%V%u" outputs the ISO 8601 format containing the week-oriented date without century or punctuation. %G and %g were introduced more recently by Robbins, and they are also current practice, though not as widespread as %u: they are supported by the Robbins and Olson public-domain implementations, the GNU C library, and Linux.