The Date class have a single string parametrized constructor.
The Date class have a single string parametrized constructor.Date class with single string parameters to the Date() constructor example:-
The Date class have a single string parameterized constructor. If user pass a string parameter in the date class object, then it will convert that string in to date or time components after that return a corresponding Date object . The Date() constructor accepts a number of different string formats. User can see how to use this type of constructor for the Date class in this example.
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 = (String)(nextDay.toDateString()); mytext1.text = (String)(nextDay.toLocaleTimeString()); mytext2.text = (String)(nextDay.toLocaleString()); } ]]> </fx:Script> <s:Panel width="335" height="130" title="Date Class Panel" backgroundColor="0xE0FFFF"></s:Application> |
In this example we have created a Date class object and pass a string parameter in this object to access the parameterized constructor of the Date class and return the date and time of the corresponding the passing parameter.
Output:-
