It it now a leap year?

Robin Laing Robin.Laing at drdc-rddc.gc.ca
Thu Aug 9 16:46:49 UTC 2007


Karl Larsen wrote:
> Mike - EMAIL IGNORED wrote:
>> On Thu, 09 Aug 2007 06:02:27 +0930, Tim wrote:
>>
>>> Andrew Parker:
>>>>> For bash the following will display 061 if its currently a leap year,
>>>>> 060 otherwise
>>>>>
>>>>> date -d "$(date +%Y)/03/01" +%j
>>> Kevin J. Cummings:
>>>> It doesn't work with dates after 2037/03/01 ....
>>> Leaving you with thirty years to develop a solution, or spend a few
>>> minutes pondering whether to bother...  ;-)
>>>
>>> But seriously, although some might think you don't need to worry about
>>> such things, there are programs that will need to do some work using a
>>> date from the future.  The matter is more urgent than immediately
>>> obvious.
>>>
>> [...]
>>
>> My program deals only with the present and the immediate past.
>> Since in 30 years I hope to celebrate (?) my 98th, it would be
>> quite interesting to see if the problem still concerns me. :)
>>
>> Mike.
>>
>>
>     In a terminal type $cal 2 2008 and you will see February has 29 days 
> when it is leap year according to Google. Do $cal 2 2007 and you will 
> see this:
> 
> [karl at k5di ~]$ cal 2 2007
>    February 2007
> Su Mo Tu We Th Fr Sa
>              1  2  3
>  4  5  6  7  8  9 10
> 11 12 13 14 15 16 17
> 18 19 20 21 22 23 24
> 25 26 27 28
> 
> So no leap year in 2007
> 
> 

And Cal works after 2037

[rlaing at eagle1 ~]$ cal 2 2039
    February 2039
Su Mo Tu We Th Fr Sa
        1  2  3  4  5
  6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28

[rlaing at eagle1 ~]$ cal 2 2040
    February 2040
Su Mo Tu We Th Fr Sa
           1  2  3  4
  5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29



-- 
Due to the move to Exchange Server,
    anything that is a priority, please phone.
Robin Laing




More information about the users mailing list