<?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: Calculating the number of days between two selected dates in a DateChooser control</title>
	<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Fri, 05 Dec 2008 11:43:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<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-12385</link>
		<author>Rhoby</author>
		<pubDate>Wed, 30 Apr 2008 10:30:15 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-12385</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-12365</link>
		<author>peterd</author>
		<pubDate>Tue, 29 Apr 2008 19:18:50 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-12365</guid>
		<description>&lt;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"&gt;Rhoby&lt;/a&gt;,

I'm sure there is a better, more efficient way, but maybe this helps:
&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#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[
            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 &#62; 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 &#60;= numDays; idx++) {
                        retDate = new Date(ranges.rangeStart.time);
                        retDate.date += idx;
                        textArea.text += retDate.toDateString() + "\n";
                    }
                }
            }
        ]]&#62;
    &#60;/mx:Script&#62;

    &#60;mx:DateChooser id="dateChooser"
            allowMultipleSelection="true"
            change="dateChooser_change(event);" /&#62;

    &#60;mx:TextArea id="textArea"
            editable="false"
            selectable="false"
            width="320"
            height="240" /&#62;

&#60;/mx:Application&#62;
&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-12359</link>
		<author>Rhoby</author>
		<pubDate>Tue, 29 Apr 2008 10:20:32 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-12359</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-7710</link>
		<author>libran</author>
		<pubDate>Thu, 20 Mar 2008 06:16:16 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-7710</guid>
		<description>good！^_^</description>
		<content:encoded><![CDATA[<p>good！^_^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergey</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-4386</link>
		<author>Sergey</author>
		<pubDate>Tue, 20 Nov 2007 16:36:26 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-4386</guid>
		<description>How its working?</description>
		<content:encoded><![CDATA[<p>How its working?</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-50</link>
		<author>peterd</author>
		<pubDate>Sat, 04 Aug 2007 06:00:15 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-50</guid>
		<description>Sandeep,

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.</description>
		<content:encoded><![CDATA[<p>Sandeep,</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>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sandeep</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-48</link>
		<author>Sandeep</author>
		<pubDate>Sat, 04 Aug 2007 05:36:39 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-48</guid>
		<description>how do u select the range here.</description>
		<content:encoded><![CDATA[<p>how do u select the range here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Odo</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-13</link>
		<author>Odo</author>
		<pubDate>Wed, 01 Aug 2007 15:01:14 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-13</guid>
		<description>Ok thnx :) That works.</description>
		<content:encoded><![CDATA[<p>Ok thnx :) That works.</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-12</link>
		<author>peterd</author>
		<pubDate>Wed, 01 Aug 2007 13:37:09 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-12</guid>
		<description>Odo,

Hold down the Shift key.</description>
		<content:encoded><![CDATA[<p>Odo,</p>
<p>Hold down the Shift key.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Odo</title>
		<link>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-11</link>
		<author>Odo</author>
		<pubDate>Wed, 01 Aug 2007 09:09:27 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/31/calculating-the-number-of-days-between-two-selected-dates-in-a-datechooser-control/#comment-11</guid>
		<description>Hmm...this do not work. It only reports 1 day for every selection !</description>
		<content:encoded><![CDATA[<p>Hmm&#8230;this do not work. It only reports 1 day for every selection !</p>
]]></content:encoded>
	</item>
</channel>
</rss>
