I often have to have date-specific messaging for advertisements I build, so here is some help in case you need some date messaging as well. This function will return “true” if the target date is AFTER the current date. It will return “false” if the current date is AFTER the target date. Mostly, this will help you in case you need to have “plays tonight” or “starts tomorrow” messaging. Of course, you can use this as a starter and create much more date-specific messaging.

How to use:
Simply call the function and pass in the target date, ie, isCurrentDateAfterTarget(2013, 4, 2) will return true if today’s date if after April 2nd, 2013.

public function isCurrentDateAfterTarget(year:int, month:int, day:int):Boolean
{
//NOTE: Month is between 1 (January) and 12(December) – Flash starts the month on 0, but i don't like this, so I offset it by 1

	var currentDate = new Date();
	var targetDate = new Date(year, month – 1, day); ///month – 1 is because the date object uses 0 – 11 for months. To make it easy, we will use 1 – 12.

	if (currentDate.getTime() >= targetDate.getTime())
	{
		return true;
	}

	else
	{
	return false;
	}
}