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>