views:

41

answers:

1

Hi Guys

I am having a problem with flex. How can I get the number of Days in a particular month in Flex?

Thanks

+2  A: 

Use the Date object , setting the day to 0, getDate will return the last day in the month which is also the day count; you have also to give the year you want to check, because you know february can have 29 days.

function getDayCount(year:int, month:int):int{
 var d:Date=new Date(year, month, 0);
 return d.getDate();
}

trace(getDayCount(2012,2));
Patrick
getDayCount() :-)
clownbaby
@clownbaby yes right thanks :)
Patrick