Return to Snippet

Revision: 27382
at June 4, 2010 09:59 by adrianparr


Initial Code
function getYYMMDD():String
{
	var dateObj:Date = new Date();
	var year:String = String(dateObj.getFullYear());
	var month:String = String(dateObj.getMonth() + 1);
	if (month.length == 1) {
		month = "0"+month;
	}
	var date:String = String(dateObj.getDate());
	if (date.length == 1) {
		date = "0"+date;
	}
	return year.substring(2, 4)+month+date;
}

trace(getYYMMDD());

// OUTPUT
// 100604

Initial URL

                                

Initial Description

                                

Initial Title
AS3 Get the Current Date in the Format YYMMDD (Reverse format)

Initial Tags
date, format

Initial Language
ActionScript 3