This is the mail archive of the
mailing list for the GCC project.
Re: warning: `%y' yields only last 2 digits of year
- From: Andreas Schwab <schwab at suse dot de>
- To: dewar at gnat dot com (Robert Dewar)
- Cc: clock at atrey dot karlin dot mff dot cuni dot cz, fw at deneb dot enyo dot de, gcc at gcc dot gnu dot org
- Date: Wed, 13 Mar 2002 18:00:16 +0100
- Subject: Re: warning: `%y' yields only last 2 digits of year
- References: <20020313145039.45726F2F02@nile.gnat.com>
email@example.com (Robert Dewar) writes:
|> <<Which is still wrong since years can span more than just 1900 - 2099.
|> What's wrong with using %Y in the first place?
|> You missed my point entirely, probably from not being aware of the Y2K
|> issues and solutions.
I am well aware of the Y2K problem.
|> A common technique for dealing with the Y2K problem, in cases where it is
|> impractical to modify data structures or databases, is to use what is usually
|> called windowing.
|> For instance an insurance company may know that it did not exist before
|> 1982, so any date in the range 82-99 is 1982-1999, and any date in the
|> range 00-81 is 2000-2081. This would of course be suitable only for
|> policy inception dates, not for client birthdates, but for the inception
|> date use, this can keep them going another 80 years, which may be plenty
|> (if for example they anticipate a complete system rewrite before 2080).
|> It was *specifically* for that common technique that I gave my example, and
|> the suggestion of using %Y is irrelevant.
Why? You can do your calculation to convert a 2-digit year to a 4-digit
year and then just use %Y. Do I miss anything?
Andreas Schwab, SuSE Labs, firstname.lastname@example.org
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."