PDA

View Full Version : how to get the current date


arun vallappan
09-26-2007, 10:26 PM
hi
can anyone tell me how to get the current date
thanks in advance

drkstr
09-26-2007, 11:27 PM
var currentDate:Date = new Date();

Best Regards,
...aaron

uday_sgh
12-05-2008, 06:46 PM
hi
can anyone tell me how to get the current date
thanks in advance


You can get current date by using this code:

var t:Date = new Date();
trace(t.date);
// Get current year:
trace(t.fullYear);
//Get current month and Day...
trace(t.month+1);
trace(t.day+1);
// NOTE: the month and day will be numeric number January=0, February=1 ..... December=11 And Sunday=0, Monday=1....Saturday=7

Please let me know this code is working or not.

Thanks,
Uday
uday_sgh at yahoo
Sr. Flash Developer
Hyderabad

sammy123
10-08-2010, 06:22 PM
With the format var currentDate:Date = new Date();, is there a way for it to display only day, date, year, and time, without the GMT-0500 or whatever? That info isnt needed, and is more of an eyesore than a help. Thx!

drkstr
10-09-2010, 12:26 AM
Use the DateFormatter (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/formatters/DateFormatter.html) class.