Re: It it now a leap year?

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

 



On 8/8/07, Kevin J. Cummings <cummings@xxxxxxxxxxxxxxxxxx> wrote:
> Andrew Parker wrote:
> > On 8/8/07, Mike - EMAIL IGNORED <m_d_berger_1900@xxxxxxxxx> wrote:
> >> Is there a system call or variable that will
> >> tell me if it is now a leap year, or should I
> >> do the arithmetic?
> >
> > For bash the following will display 061 if its currently a leap year,
> > 060 otherwise
> >
> > date -d "$(date +%Y)/03/01" +%j
>
> It doesn't work with dates after 2037/03/01 ....

I may be being pedantic, but the requirement was to determine if the
*current* year was a leap year.  I am willing to bet that this code
will still work in 2038 as "date" will be using more than 31 bits by
then.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux