<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Parsing ISO dates with Flex and ActionScript</title>
	<link>http://blog.flexexamples.com/2008/02/02/parsing-iso-dates-with-flex-and-actionscript/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Thu, 08 Jan 2009 17:46:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: Robert</title>
		<link>http://blog.flexexamples.com/2008/02/02/parsing-iso-dates-with-flex-and-actionscript/#comment-11255</link>
		<author>Robert</author>
		<pubDate>Tue, 08 Apr 2008 14:43:14 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/02/02/parsing-iso-dates-with-flex-and-actionscript/#comment-11255</guid>
		<description>David, Peter

From my experience, if you can't guarantee the given parameter dateStr is a valid date you should check for NaN using isNaN(i).
Many thanks for the useful example!

Have fun
Robert</description>
		<content:encoded><![CDATA[<p>David, Peter</p>
<p>From my experience, if you can&#8217;t guarantee the given parameter dateStr is a valid date you should check for NaN using isNaN(i).<br />
Many thanks for the useful example!</p>
<p>Have fun<br />
Robert</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/02/02/parsing-iso-dates-with-flex-and-actionscript/#comment-7095</link>
		<author>peterd</author>
		<pubDate>Wed, 20 Feb 2008 21:02:26 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/02/02/parsing-iso-dates-with-flex-and-actionscript/#comment-7095</guid>
		<description>David,

Great tip, thanks!

Peter</description>
		<content:encoded><![CDATA[<p>David,</p>
<p>Great tip, thanks!</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Bates</title>
		<link>http://blog.flexexamples.com/2008/02/02/parsing-iso-dates-with-flex-and-actionscript/#comment-7070</link>
		<author>David Bates</author>
		<pubDate>Tue, 19 Feb 2008 15:20:12 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/02/02/parsing-iso-dates-with-flex-and-actionscript/#comment-7070</guid>
		<description>Thanks for the code - a real life saver!  

The only thing your function doesn't deal with is the "null" ISO date: 0001-01-01T00:00:00.  I would have expected this function to return a null Date object if it were passed this String.

&lt;pre class="code"&gt;
public static function parseIsoDate(dateStr:String):Date
{
	dateStr = dateStr.replace(/-/g, "/");
	dateStr = dateStr.replace("T", " ");
	dateStr = dateStr.replace("Z", " GMT-0000");
	const i:Number = Date.parse(dateStr);

	if (i &#60; 0)
	{
		return null;
	}               
	else 
	{
		return new Date(i);
	}                                
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Thanks for the code - a real life saver!  </p>
<p>The only thing your function doesn&#8217;t deal with is the &#8220;null&#8221; ISO date: 0001-01-01T00:00:00.  I would have expected this function to return a null Date object if it were passed this String.</p>
<pre class="code">
public static function parseIsoDate(dateStr:String):Date
{
	dateStr = dateStr.replace(/-/g, "/");
	dateStr = dateStr.replace("T", " ");
	dateStr = dateStr.replace("Z", " GMT-0000");
	const i:Number = Date.parse(dateStr);

	if (i &lt; 0)
	{
		return null;
	}
	else
	{
		return new Date(i);
	}
}
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
