<?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: Mastering the date object in javascript</title>
	<atom:link href="http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/</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: Dan</title>
		<link>http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/comment-page-1/#comment-727</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Wed, 18 Mar 2009 19:43:15 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=30#comment-727</guid>
		<description>@bartek Thanks! I updated the code.</description>
		<content:encoded><![CDATA[<p>@bartek Thanks! I updated the code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bartek</title>
		<link>http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/comment-page-1/#comment-726</link>
		<dc:creator>bartek</dc:creator>
		<pubDate>Wed, 18 Mar 2009 19:21:47 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=30#comment-726</guid>
		<description>Thanks for great tips!
Remember that &quot;getMonth()&quot; returns the month as number between 0 and 11.
In your formatting example you need to increase month by one.</description>
		<content:encoded><![CDATA[<p>Thanks for great tips!<br />
Remember that &#8220;getMonth()&#8221; returns the month as number between 0 and 11.<br />
In your formatting example you need to increase month by one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How to know if it&#8217;s a leap year &#124; Javascript Kata</title>
		<link>http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/comment-page-1/#comment-715</link>
		<dc:creator>How to know if it&#8217;s a leap year &#124; Javascript Kata</dc:creator>
		<pubDate>Thu, 19 Feb 2009 13:01:44 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=30#comment-715</guid>
		<description>[...] the magic part of it. As I said in Mastering the date object in Javascript, there&#8217;s a special twist that let you work with dates differently than in most of the [...]</description>
		<content:encoded><![CDATA[<p>[...] the magic part of it. As I said in Mastering the date object in Javascript, there&#8217;s a special twist that let you work with dates differently than in most of the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: geoffrey.mcgill</title>
		<link>http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/comment-page-1/#comment-457</link>
		<dc:creator>geoffrey.mcgill</dc:creator>
		<pubDate>Tue, 18 Mar 2008 19:27:30 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=30#comment-457</guid>
		<description>Hi Dan,

We&#039;ve been working on a JavaScript Date library for a while that you might find useful. 

http://www.datejs.com/

One major piece of functionality we include is a new Parser.

Parsing Example
alert(Date.parse(&quot;next friday&quot;));

Here&#039;s a couple other samples which may be relevant to your samples.

Formatting Example
alert(new Date(&quot;yyyy-MM-dd&quot;));

Add/Subtract Example
new Date().add(5).days();
Date.today().add(-5).months();

Hope this helps.</description>
		<content:encoded><![CDATA[<p>Hi Dan,</p>
<p>We&#8217;ve been working on a JavaScript Date library for a while that you might find useful. </p>
<p><a href="http://www.datejs.com/" rel="nofollow">http://www.datejs.com/</a></p>
<p>One major piece of functionality we include is a new Parser.</p>
<p>Parsing Example<br />
alert(Date.parse(&#8220;next friday&#8221;));</p>
<p>Here&#8217;s a couple other samples which may be relevant to your samples.</p>
<p>Formatting Example<br />
alert(new Date(&#8220;yyyy-MM-dd&#8221;));</p>
<p>Add/Subtract Example<br />
new Date().add(5).days();<br />
Date.today().add(-5).months();</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Reischl</title>
		<link>http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/comment-page-1/#comment-174</link>
		<dc:creator>Brian Reischl</dc:creator>
		<pubDate>Mon, 21 May 2007 14:44:16 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=30#comment-174</guid>
		<description>I&#039;ve been using Matt Kruse&#039;s date formatting library and I find it works quite well. It definitely beats using string concatenation.

http://www.mattkruse.com/javascript/date/source.html</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been using Matt Kruse&#8217;s date formatting library and I find it works quite well. It definitely beats using string concatenation.</p>
<p><a href="http://www.mattkruse.com/javascript/date/source.html" rel="nofollow">http://www.mattkruse.com/javascript/date/source.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Vit</title>
		<link>http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/comment-page-1/#comment-173</link>
		<dc:creator>Andrew Vit</dc:creator>
		<pubDate>Sun, 20 May 2007 18:45:24 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=30#comment-173</guid>
		<description>Dates are unusable when dealing with anything before 1970, so if you deal with birthdate input and need to calculate an age on the client side, don&#039;t use Date to help with the arithmetic. I found it&#039;s best to calculate age from separate year/month/day integers.</description>
		<content:encoded><![CDATA[<p>Dates are unusable when dealing with anything before 1970, so if you deal with birthdate input and need to calculate an age on the client side, don&#8217;t use Date to help with the arithmetic. I found it&#8217;s best to calculate age from separate year/month/day integers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/comment-page-1/#comment-172</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Fri, 18 May 2007 18:11:44 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=30#comment-172</guid>
		<description>@Jon
This is a great tip! I&#039;ll remember it...</description>
		<content:encoded><![CDATA[<p>@Jon<br />
This is a great tip! I&#8217;ll remember it&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/comment-page-1/#comment-171</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Fri, 18 May 2007 17:58:39 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=30#comment-171</guid>
		<description>Along the same lines as your way of adding dates, some people have troubles knowing if a month has 31, 30, 28, or 29 days in it.  They typically devise elaborate sets of arrays and calculations for number of days in a given month depending on if it&#039;s a leap year, etc.

It&#039;s surprisingly easy to get the info; you just set the following month&#039;s day = 0.  12/0/2007 === 11/30/2007

To find out how many days are in the current month:
[code]
var now = new Date();
now.setMonth(now.getMonth() + 1);
now.setDate(0);
alert(now.getDate());
[/code]</description>
		<content:encoded><![CDATA[<p>Along the same lines as your way of adding dates, some people have troubles knowing if a month has 31, 30, 28, or 29 days in it.  They typically devise elaborate sets of arrays and calculations for number of days in a given month depending on if it&#8217;s a leap year, etc.</p>
<p>It&#8217;s surprisingly easy to get the info; you just set the following month&#8217;s day = 0.  12/0/2007 === 11/30/2007</p>
<p>To find out how many days are in the current month:<br />
[code]<br />
var now = new Date();<br />
now.setMonth(now.getMonth() + 1);<br />
now.setDate(0);<br />
alert(now.getDate());<br />
[/code]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Giotta</title>
		<link>http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/comment-page-1/#comment-170</link>
		<dc:creator>John Giotta</dc:creator>
		<pubDate>Fri, 18 May 2007 14:00:05 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=30#comment-170</guid>
		<description>I&#039;ve always found it odd how some developers create an Array of days in a month and may do a leap year check to if position 1 of the array is 28 or 29.

Unless I&#039;m incorrect why not this?
Date.prototype.getMonthDays = function(month) {
	var temp_date = new Date(this.getFullYear(), this.getMonth()+1, 1);
	temp_date.setDate(temp_date.getDate()-1);
	return temp_date.getDate();
};

Works no matter if the year is leap or not. And gets rid of that useless array.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve always found it odd how some developers create an Array of days in a month and may do a leap year check to if position 1 of the array is 28 or 29.</p>
<p>Unless I&#8217;m incorrect why not this?<br />
Date.prototype.getMonthDays = function(month) {<br />
	var temp_date = new Date(this.getFullYear(), this.getMonth()+1, 1);<br />
	temp_date.setDate(temp_date.getDate()-1);<br />
	return temp_date.getDate();<br />
};</p>
<p>Works no matter if the year is leap or not. And gets rid of that useless array.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: K. Adam Christensen</title>
		<link>http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/comment-page-1/#comment-169</link>
		<dc:creator>K. Adam Christensen</dc:creator>
		<pubDate>Sun, 29 Apr 2007 12:38:02 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=30#comment-169</guid>
		<description>Since that got cut off, try http://pastie.caboo.se/57443 for the example</description>
		<content:encoded><![CDATA[<p>Since that got cut off, try <a href="http://pastie.caboo.se/57443" rel="nofollow">http://pastie.caboo.se/57443</a> for the example</p>
]]></content:encoded>
	</item>
</channel>
</rss>
