<?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: JavaScript: Working with Dates Returned from Web Service Calls</title>
	<atom:link href="http://blogs.infinite-x.net/2009/06/10/javascript-working-with-dates-returned-from-web-service-calls/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.infinite-x.net/2009/06/10/javascript-working-with-dates-returned-from-web-service-calls/</link>
	<description>Sharing information with Dynamics CRM users and xRM developers</description>
	<lastBuildDate>Wed, 08 Feb 2012 23:58:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: mitch</title>
		<link>http://blogs.infinite-x.net/2009/06/10/javascript-working-with-dates-returned-from-web-service-calls/comment-page-1/#comment-2201</link>
		<dc:creator>mitch</dc:creator>
		<pubDate>Thu, 11 Jun 2009 20:43:05 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.infinite-x.net/2009/06/10/javascript-working-with-dates-returned-from-web-service-calls/#comment-2201</guid>
		<description>Thanks Moti. Revised code has been noted.</description>
		<content:encoded><![CDATA[<p>Thanks Moti. Revised code has been noted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Moti M.</title>
		<link>http://blogs.infinite-x.net/2009/06/10/javascript-working-with-dates-returned-from-web-service-calls/comment-page-1/#comment-2200</link>
		<dc:creator>Moti M.</dc:creator>
		<pubDate>Thu, 11 Jun 2009 20:28:47 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.infinite-x.net/2009/06/10/javascript-working-with-dates-returned-from-web-service-calls/#comment-2200</guid>
		<description>Your code is buggy. For example, it would not work for dates in August or Septemeber.

To fix it, you need to use the radix argument for the parseInt method. Otherwise, any string input starting with a 0, will be treated as an octal base number.

Here is the fix:
function ConvertDateFromUTC(startDate){  
// UTC time formatted string   
//2009-03-25T09:30:00-00:00    //         1         2    //1234567890123456789012345     

var year = parseInt(startDate.substr(0, 4),10);    
var month = parseInt(startDate.substr(5, 2),10);    
var day = parseInt(startDate.substr(8, 2),10);    
var hour = parseInt(startDate.substr(11, 2),10);    
var min = parseInt(startDate.substr(14, 2),10);     

return new Date(year, month - 1, day);
}</description>
		<content:encoded><![CDATA[<p>Your code is buggy. For example, it would not work for dates in August or Septemeber.</p>
<p>To fix it, you need to use the radix argument for the parseInt method. Otherwise, any string input starting with a 0, will be treated as an octal base number.</p>
<p>Here is the fix:<br />
function ConvertDateFromUTC(startDate){<br />
// UTC time formatted string<br />
//2009-03-25T09:30:00-00:00    //         1         2    //1234567890123456789012345     </p>
<p>var year = parseInt(startDate.substr(0, 4),10);<br />
var month = parseInt(startDate.substr(5, 2),10);<br />
var day = parseInt(startDate.substr(8, 2),10);<br />
var hour = parseInt(startDate.substr(11, 2),10);<br />
var min = parseInt(startDate.substr(14, 2),10);     </p>
<p>return new Date(year, month &#8211; 1, day);<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

