# LessThanDot

A Technical Community for IT Professionals

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

## LTD Social Sitings

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

### Forum Search

View active topics
My Topics

Forum
No Posts Rated

Top 50
Given

### Forum Statistics

Users
Members:
1877
Members Online:
3
Guests Online:
94

Total Post History
Posts:
81447
Topics:
18714

7-Day Post History
New Posts:
0
New Topics:
0
Active Topics:
0

AlicjaHYBCIA

### Other

FAQ
All times are UTC [ DST ]

# Calculate leapyears

Mind Boggling Puzzles, to keep that grey matter in shape...
Forum rules
Always post answers in a "Hidecode" tag, so that others have a chance to answer the question too.

### Calculate leapyears

This one is really simple.

Calculate the number of leapyears from a certain year (input) to the current date.

Some examples.

Year = 2010 result = 1 (since 2012 counts)
Year = 1999 result = 4
year = 1899 result = 28
Year = -812 result = You tell me.

As an added bonus you can list the years, but that could get tedious for -812.

Here is the wikipediaarticle on it.
pink fuzzy slippers

chrissie1
Senior Guru

Posts: 9475
Joined: Wed Oct 10, 2007 7:18 pm
Location: Belgium
Unrated

### Re: Calculate leapyears

I cannot believe that Microsoft has a support article explaining how to do it in Excel

Code is hidden, SHOW

http://support.microsoft.com/kb/214019

SQLDenis

Posts: 21784
Joined: Wed Oct 10, 2007 6:43 pm
Location: Princeton, New Jersey, USA,World, Solar System, Milky Way, Universe and Beyond
Unrated

### Re: Calculate leapyears

Heh, didn't know that there was a DateTime.IsLeapYear function in C#. Or that it only works between 1 and 9999.

Looking past the fact that the gregorian calendar didn't come into existence until the 1500's, I guess this would work.

Code is hidden, SHOW
Say what you like about the tenets of National Socialism Dude, at least it's an ethos

AlexCuse