The DateFormatter class formats a date in month, day, year format.
The DateFormatter class formats a date in month, day, year format.The DateFormatter class formats a date in month, day, year format. You can set the formatString property for date formatter. If an error occurs this error is saved to the error property. The error property has two types of error values: Invalid value, Invalid format. The tag of DateFormatter is <mx:DateFormatter>. You will be declare a formatter in <fx:Declarations> tag.
|
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s=" library://ns.adobe.com/flex/spark"xmlns:mx=" library://ns.adobe.com/flex/mx"minWidth=" 955" minHeight="600"><![CDATA[ import mx.events.ValidationResultEvent;{ result = dateValidate.validate(); if (result.type==ValidationResultEvent.VALID) {dateValue.text=dateFormatter.format(datetxt.text); } else {dateValue.text= "Invalid Date";} } ]]> day: DD, year: YYYY"/> <mx:DateValidator id="dateValidate" source="{datetxt}" property="text" inputFormat="mm/dd/yyyy"/> fontFamily="verdana"> <s:TextInput id="datetxt" color="#000000" fontFamily="verdana"/></s:Application> |
To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.