If user want to deal with date and time in the application then it can be used Date class that provide date and time related information.
If user want to deal with date and time in the application then it can be used Date class that provide date and time related information.Date Class in Action Script 3:-
If user want to deal with date and time in the application then it can be used Date class that provide date and time related information. User access the current date and time, in local time based on your time zone with the help of Date class in the application. The Date class is the top-label class that provide date and time related information. we can access and manipulate the date and time with the help of Date class.
Example:-
<?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" creationComplete="init();"> <fx:Script> <![CDATA[ public function init():void{ var currdate:Date = new Date(); mytext.text = (String)(currdate.toDateString()); mytext1.text = (String)(currdate.toLocaleTimeString()); mytext2.text = (String)(currdate.toLocaleString()); } ]]> </fx:Script> <s:Panel width="335" height="130" title="Date Class Panel" backgroundColor="0xE0FFFF"> <mx:VBox> <mx:HBox> <mx:Label text="The Current Date :"/> <mx:Text id="mytext"/> </mx:HBox> <mx:HBox> <mx:Label text="The Current Time :"/> <mx:Text id="mytext1"/> </mx:HBox> <mx:HBox> <mx:Label text="The Current Date and Time :"/> <mx:Text id="mytext2"/> </mx:HBox> </mx:VBox> </s:Panel> </s:Application> |
In this example we have created a Date class object and get the current date and time. In this example user can see how to create a Date class object in the application. Date class have four types of constructor. This example used without parameter constructor.
Output:-