Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the Current Date Time Formatted in Flex

I'm trying to get the current date time in Flex/AIR?

like image 359
Khattab Avatar asked Oct 30 '10 01:10

Khattab


2 Answers

private function CurrentDateTimeString():String
{

   var CurrentDateTime:Date = new Date();


   var DateString:String = CurrentDateTime.getMonth().toString()+ "/"+CurrentDateTime.getDate().toString() +"/"+CurrentDateTime.getFullYear().toString();
   var TimeString:String = CurrentDateTime.getHours().toString()+ ":"+ doubleDigitFormat(CurrentDateTime.getMinutes());
   var DateTimeString:String = DateString + " " + TimeString;
   return DateTimeString;
  }

function doubleDigitFormat(num:uint):String 
{

   if(num < 10) {
    return ("0" + num);
   }
   return num.toString();

  }
like image 97
Khattab Avatar answered Oct 16 '22 15:10

Khattab


currentTime = new Date();

From : http://livedocs.adobe.com/flex/3/html/help.html?content=08_Dates_and_times_5.html

and

http://docs.huihoo.com/flex/4/Date.html

like image 24
Shoban Avatar answered Oct 16 '22 16:10

Shoban