<?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>Flex Examples &#187; toDateString()</title>
	<atom:link href="http://blog.flexexamples.com/tag/todatestring/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Converting between dates and strings using the DateField class in Flex</title>
		<link>http://blog.flexexamples.com/2007/12/15/converting-between-dates-and-strings-using-the-datefield-class-in-flex/</link>
		<comments>http://blog.flexexamples.com/2007/12/15/converting-between-dates-and-strings-using-the-datefield-class-in-flex/#comments</comments>
		<pubDate>Sun, 16 Dec 2007 07:29:27 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[DateField]]></category>
		<category><![CDATA[dateToString()]]></category>
		<category><![CDATA[stringToDate()]]></category>
		<category><![CDATA[toDateString()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/15/converting-between-dates-and-strings-using-the-datefield-class-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can convert Date objects to String objects using the static DateField.dateToString() method in Flex. As an added bonus, the example also shows how you can convert String objects to Date Objects using the static DateField.stringToDate() method.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateField_stringToDate_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can convert Date objects to String objects using the static <code>DateField.dateToString()</code> method in Flex. As an added bonus, the example also shows how you can convert String objects to Date Objects using the static <code>DateField.stringToDate()</code> method.</p>
<p>Full code after the jump.</p>
<p><span id="more-367"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateField_stringToDate_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/12/15/converting-between-dates-and-strings-using-the-datefield-class-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.DateField;

            private const MASK:String = "DD/MM/YYYY";

            private function init():void {
                var today:Date = new Date();
                var halloween:String = "31/10/2007";

                var todayString:String = DateField.dateToString(today, "DD/MM/YYYY");
                todayLabel.text = todayString;

                var halloweenDate:Date = DateField.stringToDate(halloween, "DD/MM/YYYY");
                halloweenLabel.text = halloweenDate.toDateString();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Form&gt;
        &lt;mx:FormItem label="today ({MASK}):"&gt;
            &lt;mx:Label id="todayLabel" /&gt;
        &lt;/mx:FormItem&gt;
        &lt;mx:FormItem label="Halloween:"&gt;
            &lt;mx:Label id="halloweenLabel" /&gt;
        &lt;/mx:FormItem&gt;
    &lt;/mx:Form&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/DateField_stringToDate_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/DateField_stringToDate_test/bin/main.html" width="100%" height="150"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Converting between dates and strings using the DateField class in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/12/15/converting-between-dates-and-strings-using-the-datefield-class-in-flex/',contentID: 'post-367',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'dateToString(),stringToDate(),toDateString()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/12/15/converting-between-dates-and-strings-using-the-datefield-class-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting a custom label function on a Flex DateField control</title>
		<link>http://blog.flexexamples.com/2007/12/12/setting-a-custom-label-function-on-a-flex-datefield-control/</link>
		<comments>http://blog.flexexamples.com/2007/12/12/setting-a-custom-label-function-on-a-flex-datefield-control/#comments</comments>
		<pubDate>Thu, 13 Dec 2007 07:21:56 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[DateField]]></category>
		<category><![CDATA[labelFunction]]></category>
		<category><![CDATA[toDateString()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/12/setting-a-custom-label-function-on-a-flex-datefield-control/</guid>
		<description><![CDATA[<p>The following example shows how you can format the displayed date in a DateField control by setting the labelFunction property and creating a custom label function.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateField_labelFunction_test_2/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/12/12/setting-a-custom-label-function-on-a-flex-datefield-control/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ private function dateField_labelFunc(item:Date):String { if (item [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can format the displayed date in a DateField control by setting the <code>labelFunction</code> property and creating a custom label function.</p>
<p>Full code after the jump.</p>
<p><span id="more-362"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateField_labelFunction_test_2/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/12/12/setting-a-custom-label-function-on-a-flex-datefield-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function dateField_labelFunc(item:Date):String {
                if (item == null) {
                    return "";
                }
                return item.toDateString();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:DateField id="dateField"
                labelFunction="dateField_labelFunc" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Label text="{dateField.text}"
            selectable="true"
            fontSize="48"
            fontWeight="bold" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/DateField_labelFunction_test_2/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/DateField_labelFunction_test_2/bin/main.html" width="100%" height="300"></iframe></p>
<p class="construction">Well, it looks like I&#8217;m repeating entries (gasp!). I already did an entry on this several months back, <a href="http://blog.flexexamples.com/2007/07/30/formatting-dates-using-the-dateformatter/">&#8220;Formatting dates using the DateFormatter&#8221;</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a custom label function on a Flex DateField control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/12/12/setting-a-custom-label-function-on-a-flex-datefield-control/',contentID: 'post-362',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'labelFunction,toDateString()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/12/12/setting-a-custom-label-function-on-a-flex-datefield-control/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

