[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10182: Century bug in date utility?

From: Eric Blake
Subject: bug#10182: Century bug in date utility?
Date: Thu, 01 Dec 2011 10:35:31 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

tag 10182 notabug

On 12/01/2011 08:34 AM, Krzysztof Kowalski wrote:
> Hello,
> We have 2011,
> korn% date +%C
> 20
> korn% date
> Thu Dec  1 16:26:30 CET 2011

Yep.  And this behavior is mandated by POSIX for strftime(), so it is
not a bug.


    Replaced by the year divided by 100 and truncated to an integer, as
a decimal number. [ tm_year]

That is, it is NOT the "century" in the vernacular (where years in the
range [2001,2100] are collectively called the 21st century), but the
first two digits of the year.  The idea is that you combine %C%y to form %Y.

> For a test I changed system time to 1997 and date utility returned 20
> century as well :)

No, %C in 1997 returned 19.

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]