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
Shoban
2010-10-30 01:53:54
Thanks, I was trying to find the below, your links helped:
Khattab
2010-10-30 02:11:58
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
2010-10-30 02:12:32
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
2010-10-30 02:13:48