Through this example, user can see how to access the different units of time through Date object using properties or methods of the Date class.
Through this example, user can see how to access the different units of time through Date object using properties or methods of the Date class.Date class time units values example:-
Through this example, user can see how to access the different units of time through Date object using properties or methods of the 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[ mytext.text = (currdate.toLocaleString()); mytext0.text = (String)(currdate.getFullYear()); mytext1.text = (String)(currdate.month); mytext2.text = (String)(currdate.date); mytext3.text = (String)(currdate.day); mytext4.text = (String)(currdate.hours); mytext5.text = (String)(currdate.minutes); mytext6.text = (String)(currdate.seconds); mytext7.text = (String)(currdate.milliseconds); } ]]> </fx:Script> <s:Panel width="300" height="280" title="Date Class Panel with Time units value" backgroundColor="0xE0FFFF"></s:Application> |
In this example, we have created a Date class object after that we have used some properties or method of Date class to find the time units value. User can see these properties in the example.
Output:-
