<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ceres Logic :: Blog &#187; javascript</title>
	<atom:link href="http://www.cereslogic.com/pages/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cereslogic.com/pages</link>
	<description>Mobile and Web App Development</description>
	<lastBuildDate>Tue, 23 Aug 2011 14:45:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Last Day of the Month w/ JavaScript</title>
		<link>http://www.cereslogic.com/pages/2007/11/13/last-day-of-month-w-javascript/</link>
		<comments>http://www.cereslogic.com/pages/2007/11/13/last-day-of-month-w-javascript/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 15:43:00 +0000</pubDate>
		<dc:creator>mdesjardins</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://mikedesjardins.us/wordpress/?p=23</guid>
		<description><![CDATA[I recently had to calculate the last day of the month using JavaScript. When I Google&#8217;d for a way to do this (I had an idea for a solution already, but I wanted to look online first), I was pretty surprised by how much work some of the proposed solutions were, like this and (even [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to calculate the last day of the month using JavaScript.  When I Google&#8217;d for a way to do this (I had an idea for a solution already, but I wanted to look online first), I was pretty surprised by how much work some of the proposed solutions were, like <a href="http://javascript.about.com/library/bllday.htm">this</a> and (even worse) <a href="http://www.irt.org/script/1568.htm">this</a>.  One trick I learned from SQL programming is that it doesn&#8217;t need to be that complicated.  All you need to do is jump to the next month, go to the first day of that month, then subtract one day.  Here&#8217;s the code:</p>
<p><span style="font-size:85%;"><span style="font-family:courier new;">  var now = new Date();</span><br /><span style="font-family:courier new;">  now.setMonth(now.getMonth() + 1);  // rounds back to January if needed (e.g., 13th month).</span><br /><span style="font-family:courier new;">  now.setDate(0);</span>  <span style="font-family:courier new;">// now is now set to the last day of the previous month,<br />                // i.e., the &#8220;zeroth&#8221; day of the current month = the last day of the previous month.</span></p>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cereslogic.com/pages/2007/11/13/last-day-of-month-w-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

