c/3190 Re: warning: `%y' yields only last 2 digits of year
Robert Dewar
dewar@gnat.com
Tue Mar 12 15:06:00 GMT 2002
<<That date has six possible interpretations (the order of preference
between them being culturally dependent). Unless you have some
arrangement as to the interpretation of such dates with anyone who might
read them, they hardly seem like a good idea to write - certainly, when
such dates appear on web pages, they generally are confusing and it's a
matter of second-guessing the intent of the writer. I'd always use
yyyy-mm-dd (ISO 8601 format) in such a case, given a free-format date
field.
>>
Wait a moment, you are obfuscating with irrelevancy here :-)
I *specifically* talked about the date on a check (and given the spelling,
I had in mind a US check, and not a british cheque). The interpretation
of the date is quite unambiguous here, and I definitely do NOT suggest
thgat you try to use the ISO format in that context.
Actually I prefer in more general contexts to write something like
Mar 16 '02 which is clear to all (of course in those very rare contexts
where the century is not clear from context it is OK to use 2002).
But all this irrelevant discussion has nothing to do with the warning.
%y is a perfectly well defined, and useful function. it is reasonable
to assume that anyone using this function knows what it does and means
to use it.
By the way, I have often filled out goverment forms that allowed precisely
two digits for the year :-)
More information about the Gcc
mailing list