<?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: Calculating the number of days between two selected dates in a DateChooser control</title>
	<atom:link href="http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Mon, 15 Mar 2010 09:06:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/comment-page-1/#comment-181</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Thu, 04 Jun 2009 15:06:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-181</guid>
		<description>flex_learner,

You could do something like the following, which will set the selected date to July 4, 1980 and then set the DateChooser control&#039;s displayed month and year to that same date:
&lt;pre class=&quot;code&quot;&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application name=&quot;DateChooser_selectedDate_test&quot;
        xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    &lt;mx:Date id=&quot;dat&quot; fullYear=&quot;1980&quot; month=&quot;6&quot; date=&quot;4&quot; /&gt;

    &lt;mx:DateChooser id=&quot;dateChooser&quot;
            selectedDate=&quot;{dat}&quot;
            displayedYear=&quot;{dat.fullYear}&quot;
            displayedMonth=&quot;{dat.month}&quot; /&gt;

&lt;/mx:Application&gt;
&lt;/pre&gt;

The previous code will give a couple of binding warnings saying:
(a) Data binding will not be able to detect assignments to &quot;fullYear&quot;.
(b) Data binding will not be able to detect assignments to &quot;month&quot;.

The example still works, but if you don&#039;t like those warnings, you could always set the properties using ActionScript instead, as seen in the following example:
&lt;pre class=&quot;code&quot;&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application name=&quot;DateChooser_selectedDate_test&quot;
        xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.CalendarLayoutChangeEvent;

            private function dateChooser_change(evt:CalendarLayoutChangeEvent):void {
                var selDat:Date = dateChooser.selectedDate;
                dateChooser.displayedYear = selDat.fullYear;
                dateChooser.displayedMonth = selDat.month;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:DateChooser id=&quot;dateChooser&quot;
            change=&quot;dateChooser_change(event);&quot;&gt;
        &lt;mx:selectedDate&gt;
            &lt;mx:Date fullYear=&quot;1980&quot; month=&quot;6&quot; date=&quot;4&quot; /&gt;
        &lt;/mx:selectedDate&gt;
    &lt;/mx:DateChooser&gt;

    &lt;mx:Button id=&quot;btn&quot;
            label=&quot;Set new selectedDate&quot;
            click=&quot;dateChooser.selectedDate = new Date(1976, 8, 9);&quot; /&gt;

&lt;/mx:Application&gt;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>flex_learner,</p>
<p>You could do something like the following, which will set the selected date to July 4, 1980 and then set the DateChooser control&#8217;s displayed month and year to that same date:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application name="DateChooser_selectedDate_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Date id="dat" fullYear="1980" month="6" date="4" /&gt;

    &lt;mx:DateChooser id="dateChooser"
            selectedDate="{dat}"
            displayedYear="{dat.fullYear}"
            displayedMonth="{dat.month}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>The previous code will give a couple of binding warnings saying:<br />
(a) Data binding will not be able to detect assignments to &#8220;fullYear&#8221;.<br />
(b) Data binding will not be able to detect assignments to &#8220;month&#8221;.</p>
<p>The example still works, but if you don&#8217;t like those warnings, you could always set the properties using ActionScript instead, as seen in the following example:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application name="DateChooser_selectedDate_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.CalendarLayoutChangeEvent;

            private function dateChooser_change(evt:CalendarLayoutChangeEvent):void {
                var selDat:Date = dateChooser.selectedDate;
                dateChooser.displayedYear = selDat.fullYear;
                dateChooser.displayedMonth = selDat.month;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:DateChooser id="dateChooser"
            change="dateChooser_change(event);"&gt;
        &lt;mx:selectedDate&gt;
            &lt;mx:Date fullYear="1980" month="6" date="4" /&gt;
        &lt;/mx:selectedDate&gt;
    &lt;/mx:DateChooser&gt;

    &lt;mx:Button id="btn"
            label="Set new selectedDate"
            click="dateChooser.selectedDate = new Date(1976, 8, 9);" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: flex_learner</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/comment-page-1/#comment-180</link>
		<dc:creator>flex_learner</dc:creator>
		<pubDate>Thu, 04 Jun 2009 13:10:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-180</guid>
		<description>Is it possible to show the selected value dynamically in date choosed control</description>
		<content:encoded><![CDATA[<p>Is it possible to show the selected value dynamically in date choosed control</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/comment-page-1/#comment-183</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Thu, 07 May 2009 15:19:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-183</guid>
		<description>ABC,

Try clicking on Aug 6th, pressing the Shift key, and then pressing on Aug 22nd.
It should highlight each of the days between the two dates, set the range, and list the number of days as 17.

If you press the Ctrl key, I believe it selects each day individually instead of as a range/series.

Peter</description>
		<content:encoded><![CDATA[<p>ABC,</p>
<p>Try clicking on Aug 6th, pressing the Shift key, and then pressing on Aug 22nd.<br />
It should highlight each of the days between the two dates, set the range, and list the number of days as 17.</p>
<p>If you press the Ctrl key, I believe it selects each day individually instead of as a range/series.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ABC</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/comment-page-1/#comment-182</link>
		<dc:creator>ABC</dc:creator>
		<pubDate>Thu, 07 May 2009 13:10:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-182</guid>
		<description>Is this suppose to display the date selected or find the range. I m confused.</description>
		<content:encoded><![CDATA[<p>Is this suppose to display the date selected or find the range. I m confused.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/comment-page-1/#comment-185</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Tue, 24 Mar 2009 17:11:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-185</guid>
		<description>Your example seems to demonstrate the same bug(?) I&#039;m experiencing.  When the selectableRange is defined on a DateChooser and allowMultipleSelection=&quot;true&quot;, the selectedRanges do not include the rangeStart.  In fact, in your example (at least on my machine), you can&#039;t even select a range that includes the rangeStart date.  Anyone else experiencing this?</description>
		<content:encoded><![CDATA[<p>Your example seems to demonstrate the same bug(?) I&#8217;m experiencing.  When the selectableRange is defined on a DateChooser and allowMultipleSelection=&#8221;true&#8221;, the selectedRanges do not include the rangeStart.  In fact, in your example (at least on my machine), you can&#8217;t even select a range that includes the rangeStart date.  Anyone else experiencing this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/comment-page-1/#comment-184</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 17 Mar 2009 15:01:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-184</guid>
		<description>Hello Petered,

We are working with Flex Builder 3 and We need to select multiple days in a calendar
without pressing the Ctrl or Shift keys. Is it possible?

Thanks</description>
		<content:encoded><![CDATA[<p>Hello Petered,</p>
<p>We are working with Flex Builder 3 and We need to select multiple days in a calendar<br />
without pressing the Ctrl or Shift keys. Is it possible?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rhoby</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/comment-page-1/#comment-179</link>
		<dc:creator>Rhoby</dc:creator>
		<pubDate>Wed, 30 Apr 2008 10:30:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-179</guid>
		<description>Hello Petered

First, very big thank you for having responded ...
I never thought you were answering me still thank you very much
This site told me everything about Flex and I hope with all my heart that will never end ...
This is the solution that I was looking for ...
You are the best, MANY THANKS</description>
		<content:encoded><![CDATA[<p>Hello Petered</p>
<p>First, very big thank you for having responded &#8230;<br />
I never thought you were answering me still thank you very much<br />
This site told me everything about Flex and I hope with all my heart that will never end &#8230;<br />
This is the solution that I was looking for &#8230;<br />
You are the best, MANY THANKS</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/comment-page-1/#comment-178</link>
		<dc:creator>peterd</dc:creator>
		<pubDate>Tue, 29 Apr 2008 19:18:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-178</guid>
		<description>&lt;a href=&quot;http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-12359&quot; rel=&quot;nofollow&quot;&gt;Rhoby&lt;/a&gt;,

I&#039;m sure there is a better, more efficient way, but maybe this helps:
&lt;pre class=&quot;code&quot;&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.CalendarLayoutChangeEvent;
            import mx.utils.ObjectUtil;

            private var msInDay:uint = 1000 * 60 * 60 * 24;

            private function dateChooser_change(evt:CalendarLayoutChangeEvent):void {
                // textArea.text = ObjectUtil.toString(dateChooser.selectedRanges);
                textArea.text = &quot;&quot;;
                if (dateChooser.selectedRanges.length &gt; 0) {
                    var ranges:Object = dateChooser.selectedRanges[0];
                    var numDays:uint = (ranges.rangeEnd.time - ranges.rangeStart.time) / msInDay;
                    var idx:uint;
                    var retDate:Date;
                    for (idx = 0; idx &lt;= numDays; idx++) {
                        retDate = new Date(ranges.rangeStart.time);
                        retDate.date += idx;
                        textArea.text += retDate.toDateString() + &quot;\n&quot;;
                    }
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:DateChooser id=&quot;dateChooser&quot;
            allowMultipleSelection=&quot;true&quot;
            change=&quot;dateChooser_change(event);&quot; /&gt;

    &lt;mx:TextArea id=&quot;textArea&quot;
            editable=&quot;false&quot;
            selectable=&quot;false&quot;
            width=&quot;320&quot;
            height=&quot;240&quot; /&gt;

&lt;/mx:Application&gt;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p><a href="http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-12359" rel="nofollow">Rhoby</a>,</p>
<p>I&#8217;m sure there is a better, more efficient way, but maybe this helps:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&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[
            import mx.events.CalendarLayoutChangeEvent;
            import mx.utils.ObjectUtil;

            private var msInDay:uint = 1000 * 60 * 60 * 24;

            private function dateChooser_change(evt:CalendarLayoutChangeEvent):void {
                // textArea.text = ObjectUtil.toString(dateChooser.selectedRanges);
                textArea.text = "";
                if (dateChooser.selectedRanges.length &gt; 0) {
                    var ranges:Object = dateChooser.selectedRanges[0];
                    var numDays:uint = (ranges.rangeEnd.time - ranges.rangeStart.time) / msInDay;
                    var idx:uint;
                    var retDate:Date;
                    for (idx = 0; idx &lt;= numDays; idx++) {
                        retDate = new Date(ranges.rangeStart.time);
                        retDate.date += idx;
                        textArea.text += retDate.toDateString() + "\n";
                    }
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:DateChooser id="dateChooser"
            allowMultipleSelection="true"
            change="dateChooser_change(event);" /&gt;

    &lt;mx:TextArea id="textArea"
            editable="false"
            selectable="false"
            width="320"
            height="240" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rhoby</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/comment-page-1/#comment-177</link>
		<dc:creator>Rhoby</dc:creator>
		<pubDate>Tue, 29 Apr 2008 10:20:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-177</guid>
		<description>Bonjour,

How to loop for each day between 2 dates ?
thanks you very much.</description>
		<content:encoded><![CDATA[<p>Bonjour,</p>
<p>How to loop for each day between 2 dates ?<br />
thanks you very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: libran</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/comment-page-1/#comment-176</link>
		<dc:creator>libran</dc:creator>
		<pubDate>Thu, 20 Mar 2008 06:16:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-176</guid>
		<description>good！^_^</description>
		<content:encoded><![CDATA[<p>good！^_^</p>
]]></content:encoded>
	</item>
</channel>
</rss>
