Free ActionScript

Flash AS2 & AS3 Tutorials, Game Code, Effects, Source Files & Sample Downloads

Get number of days in a month

2 Comments »

Simple AS3 function to get the number of days in a month/year.

View Code ACTIONSCRIPT
function getNumberOfDays($year:int, $month:int):int
{
	var month:Date = new Date($year, $month + 1, 0);
	return month.date;
} 
 
//jan
trace(getNumberOfDays(2010, 0));  // traces 31
 
//feb
trace(getNumberOfDays(2010, 1)); // traces 28
 
//dec
trace(getNumberOfDays(2010, 11)); // traces 31

2 Responses

[...] Przeczytaj artykuł: Get number of days in a month | Free ActionScript [...]

  • [...] Read the original here: Get number of days in a month | Free ActionScript [...]

  • Leave a Reply

    You must be logged in to post a comment.