get number of days in a month
snipped by interactiveSection
Actionscript 2.0 syntax. from http://interactivesection.wordpress.com/
Just like the Actionscript 2.0 syntax, the param month ranges from 0 to11, where 0 refers to January.
class DateUtils { private static var NUM_MSEC_IN_SECOND:Number = 1000; private static var NUM_SEC_IN_MINUTE:Number = 60; private static var NUM_MIN_IN_HOUR:Number = 60; private static var NUM_HOUR_IN_DAY:Number = 24; private static var NUM_MON_IN_YEAR:Number = 12; public static function getNumDaysInMonth(year:Number,month:Number):Number { if (month<0 || month>=NUM_MON_IN_YEAR) return 0; var firstDayInThisMonth:Date = new Date(year,month,1); var firstDayInNextMonth:Date = (month<NUM_MON_IN_YEAR-1) ? new Date(year,month+1,1) : new Date(year+1,month+1-NUM_MON_IN_YEAR,1); var numDays:Number = (firstDayInNextMonth.getTime() - firstDayInThisMonth.getTime()) / NUM_MSEC_IN_SECOND / NUM_SEC_IN_MINUTE / NUM_MIN_IN_HOUR / NUM_HOUR_IN_DAY; return Math.floor(numDays); } }




