[Top][All Lists]

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

Re: date: century option

From: Bob Proulx
Subject: Re: date: century option
Date: Thu, 10 Feb 2005 00:17:07 -0700
User-agent: Mutt/1.5.6+20040907i

Fabrice Baro wrote:
> The %C option for the "date" command returns the "year  divided  by  
> 100  and  truncated  to an integer". For exemple, "date +%C" returns 20. 

Here is what the standards documents say about it.

  Century (a year divided by 100 and truncated to an integer) as a
  decimal number [00-99].

The algorithm is explicit that %C is the two digit century part of the
current year.  For example, this should return the current year.

  date +%C%y

> But we are in the 21st century, aren't we ? Why not return the year/100 
> + 1 to give the correct century ?

This is not the same as the 20th or 21st century definition.  It is
instead used to slice up the date into component parts.


reply via email to

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