<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to know if it&#8217;s a leap year</title>
	<atom:link href="http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/</link>
	<description>Advanced katas for javascripters</description>
	<lastBuildDate>Fri, 30 Jul 2010 18:10:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Trent Gardner</title>
		<link>http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/comment-page-1/#comment-938</link>
		<dc:creator>Trent Gardner</dc:creator>
		<pubDate>Mon, 26 Jul 2010 10:31:06 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=42#comment-938</guid>
		<description>function isLeap(year) {&lt;br&gt;    return (year % 400 == 0 &#124;&#124; (year % 100 != 0 &amp;&amp; year % 4 == 0));&lt;br&gt;}&lt;br&gt;&lt;br&gt;Should be the most efficient way to calculate this.</description>
		<content:encoded><![CDATA[<p>function isLeap(year) {<br />    return (year % 400 == 0 || (year % 100 != 0 &#038;&#038; year % 4 == 0));<br />}</p>
<p>Should be the most efficient way to calculate this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pkang</title>
		<link>http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/comment-page-1/#comment-794</link>
		<dc:creator>pkang</dc:creator>
		<pubDate>Sun, 27 Sep 2009 03:47:53 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=42#comment-794</guid>
		<description>here is an article of how to determine a leap year.

http://faq.puthik.com/js/js_faq_leapY.html</description>
		<content:encoded><![CDATA[<p>here is an article of how to determine a leap year.</p>
<p><a href="http://faq.puthik.com/js/js_faq_leapY.html" rel="nofollow">http://faq.puthik.com/js/js_faq_leapY.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/comment-page-1/#comment-740</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Tue, 28 Apr 2009 18:27:33 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=42#comment-740</guid>
		<description>@pam
From the &quot;leap year&quot; article on Wikipedia :
&quot;However, some exceptions to this rule are required since the duration of a solar year is slightly less than 365.25 days. Years that are divisible by 100 are not leap years, unless they are also divisible by 400, in which case they are leap years.&quot;

Take a look at http://en.wikipedia.org/wiki/Leap_year</description>
		<content:encoded><![CDATA[<p>@pam<br />
From the &#8220;leap year&#8221; article on Wikipedia :<br />
&#8220;However, some exceptions to this rule are required since the duration of a solar year is slightly less than 365.25 days. Years that are divisible by 100 are not leap years, unless they are also divisible by 400, in which case they are leap years.&#8221;</p>
<p>Take a look at <a href="http://en.wikipedia.org/wiki/Leap_year" rel="nofollow">http://en.wikipedia.org/wiki/Leap_year</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pam</title>
		<link>http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/comment-page-1/#comment-739</link>
		<dc:creator>pam</dc:creator>
		<pubDate>Tue, 28 Apr 2009 18:19:40 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=42#comment-739</guid>
		<description>Why do you guys have to make things so complicated?  If the last digit of the year ends with a 0,2,4,6, or 8 then its a leap year!  It doesn&#039;t take a rocket scientist to figure that one out!</description>
		<content:encoded><![CDATA[<p>Why do you guys have to make things so complicated?  If the last digit of the year ends with a 0,2,4,6, or 8 then its a leap year!  It doesn&#8217;t take a rocket scientist to figure that one out!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dear john</title>
		<link>http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/comment-page-1/#comment-730</link>
		<dc:creator>dear john</dc:creator>
		<pubDate>Fri, 27 Mar 2009 19:21:55 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=42#comment-730</guid>
		<description>if you ever forget how to calculate:
http://en.wikipedia.org/wiki/Leap_year

and there is also pseudo-code which can easily be translated to any language.</description>
		<content:encoded><![CDATA[<p>if you ever forget how to calculate:<br />
<a href="http://en.wikipedia.org/wiki/Leap_year" rel="nofollow">http://en.wikipedia.org/wiki/Leap_year</a></p>
<p>and there is also pseudo-code which can easily be translated to any language.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aunt Edie</title>
		<link>http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/comment-page-1/#comment-729</link>
		<dc:creator>Aunt Edie</dc:creator>
		<pubDate>Fri, 20 Mar 2009 20:32:55 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=42#comment-729</guid>
		<description>I like the one from Katatunix--easy to see the date logic and its progression returns a value as quickly as possible. Thanks!</description>
		<content:encoded><![CDATA[<p>I like the one from Katatunix&#8211;easy to see the date logic and its progression returns a value as quickly as possible. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/comment-page-1/#comment-716</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Thu, 19 Feb 2009 13:04:39 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=42#comment-716</guid>
		<description>Why does everyone wants to use the old way with the if and the modulo?

&lt;strong&gt;new Date(theYear,1,29).getDate() == 29&lt;/strong&gt; is so much better!</description>
		<content:encoded><![CDATA[<p>Why does everyone wants to use the old way with the if and the modulo?</p>
<p><strong>new Date(theYear,1,29).getDate() == 29</strong> is so much better!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ALT</title>
		<link>http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/comment-page-1/#comment-714</link>
		<dc:creator>ALT</dc:creator>
		<pubDate>Thu, 19 Feb 2009 02:51:57 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=42#comment-714</guid>
		<description>if ( ((year % 4 == 0) &amp;&amp; !(year % 100 == 0))
                     &#124;&#124; (year % 400 == 0) )
                    numDays = 29;
                else
                    numDays = 28;</description>
		<content:encoded><![CDATA[<p>if ( ((year % 4 == 0) &amp;&amp; !(year % 100 == 0))<br />
                     || (year % 400 == 0) )<br />
                    numDays = 29;<br />
                else<br />
                    numDays = 28;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SANiK</title>
		<link>http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/comment-page-1/#comment-571</link>
		<dc:creator>SANiK</dc:creator>
		<pubDate>Mon, 01 Sep 2008 02:41:10 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=42#comment-571</guid>
		<description>Correct code:
var dateObject = new Date(theYear,1,29);
var isLeap = dateObject.getDate() == 29;

To get the # of days in February, one would do:
var dateObject = new Date(theYear,2,0);
var daysInMonth = dateObject.getDate();

&quot;Huh, why is it a &#039;2&#039; now?&quot;
Date(2008, 2, 1) is March 1st which is &#039;1&#039;
Date(2008, 2, 0) is March 0, which doesn&#039;t exist and it would wrap BACK to February =o</description>
		<content:encoded><![CDATA[<p>Correct code:<br />
var dateObject = new Date(theYear,1,29);<br />
var isLeap = dateObject.getDate() == 29;</p>
<p>To get the # of days in February, one would do:<br />
var dateObject = new Date(theYear,2,0);<br />
var daysInMonth = dateObject.getDate();</p>
<p>&#8220;Huh, why is it a &#8217;2&#8242; now?&#8221;<br />
Date(2008, 2, 1) is March 1st which is &#8217;1&#8242;<br />
Date(2008, 2, 0) is March 0, which doesn&#8217;t exist and it would wrap BACK to February =o</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Simard</title>
		<link>http://www.javascriptkata.com/2007/05/24/how-to-know-if-its-a-leap-year/comment-page-1/#comment-371</link>
		<dc:creator>Dan Simard</dc:creator>
		<pubDate>Mon, 10 Dec 2007 21:07:17 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=42#comment-371</guid>
		<description>The point was that 

new Date(theYear,1,29).getDate() == 29

was the easiest way of doing it. No hard to read parenthesis or special move, just a simple date object creation...</description>
		<content:encoded><![CDATA[<p>The point was that </p>
<p>new Date(theYear,1,29).getDate() == 29</p>
<p>was the easiest way of doing it. No hard to read parenthesis or special move, just a simple date object creation&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
