Use Date from a Calendar Control : DateField « Components « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Components » DateFieldScreenshots 
Use Date from a Calendar Control
Use Date from a Calendar Control
         

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">

    <mx:Form>
        <mx:FormItem label="Start Date">
            <mx:DateField id="startDate" change="update(event)"/>
        </mx:FormItem>
        <mx:FormItem label="End Date">
            <mx:DateChooser id="endDate" change="update(event)"/>
        </mx:FormItem>
        <mx:FormItem label="Trip Duration (days)">
            <mx:Label id="display"/>
        </mx:FormItem>
    </mx:Form>

    <mx:Script>
        
            import mx.events.CalendarLayoutChangeEvent;
            private function update(evt:CalendarLayoutChangeEvent):void {
                var MILLISECONDS:int 1000;
                var SECONDS:int 60;
                var MINUTES:int 60;
                var HOURS:int 24;

                var diff:Number = endDate.selectedDate.getTime() - startDate.selectedDate.getTime();
                var days:int int(diff/(MILLISECONDS*SECONDS*MINUTES*HOURS));
                display.text = days.toString();
            }
      
    </mx:Script>
</mx:Application>
    
    

   
    
    
    
    
    
    
    
    
  
Related examples in the same category
1.Use DateField to let user choose dateUse DateField to let user choose date
2.DateField form itemDateField form item
3.Use ActionScript to set initial selected date for a DateField controlUse ActionScript to set initial selected date for a DateField control
4.DateField Item EditorDateField Item Editor
5.DateField renderer for ListDateField renderer for List
6.Date Entry with DateFieldDate Entry with DateField
7.Use an array to set the disabledDays property for DateField.Use an array to set the disabledDays property for DateField.
8.Using DateField as List EditorUsing DateField as List Editor
9.Set the disabledDays property in two different ways: using tags and using tag attributesSet the disabledDays property in two different ways: using tags and using tag attributes
10.Set the formatString property to "MM/DD/YY" to display a two-digit yearSet the formatString property to
www_._j___a__v__a__2__s__.___c_o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.