Share on Google+Share on Google+

Date Class with multiple numeric parameter constructor

In this example we have created Date class object and pass multiple numeric parameters.

Date class with multiple numeric parameters to the Date() constructor example:-

In this example we have created Date class object and pass multiple numeric parameters as  the year, month, day, hour, minute, second, and millisecond, respectively, and returns a corresponding Date object. The date class object take time information of the midnight to the related date. This is the example of multiple numeric parameterized constructor of the date class.


<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx=""


xmlns:mx="library://" creationComplete="init();">



public function init():void{

var currdate:Date = new Date(2010, 5, 1, 0, 0, 0, 0);

mytext.text = (String)(currdate.toDateString());

mytext1.text = (String)(currdate.toLocaleTimeString());

mytext2.text = (String)(currdate.toLocaleString());




<s:Panel width="335" height="130" title="Date Class Panel" backgroundColor="0xE0FFFF">



<mx:Label text="The Current Date :"/>

<mx:Text id="mytext"/>



<mx:Label text="The Current Time :"/>

<mx:Text id="mytext1"/>



<mx:Label text="The Current Date and Time :"/>

<mx:Text id="mytext2"/>





In this example we have pass values 2010 for year , 5 for month, 1 for day, 0's for hours, minutes, seconds, and milliseconds. Users note that the month value is starts 0 to11 so the numeric value 5 have corresponding month is June.


Download this code



Posted on: June 2, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null