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

Re: It it now a leap year?



Mike - EMAIL IGNORED 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?

Probably lots of ways in lots of languages, but just for kicks (should be all on one line):

perl -MDate::Calc -e "print Date::Calc::leap_year((localtime())[5]+1900)?'Leap year':'Not leap year'"

This uses the Date::Calc module in Perl which does loads of nice date calculations and manipulations. You can install this with

yum install perl-Date-Calc

and then 'man Date::Calc' to see the documentation.

Simon.


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