views:

33

answers:

2

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

+2  A: 
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

Shoban
Thanks, I was trying to find the below, your links helped:
Khattab
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();}
Khattab
A: 

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();

}

Khattab