* Program....: DOWINMONTH.PRG * Version....: 1.0 * Author.....: Andrew Coates * Date.......: January 6, 2000 * Notice.....: Copyright © 2000 Civil Solutions, All Rights Reserved. * Compiler...: Visual FoxPro 06.00.8492.00 for Windows * Abstract...: Returns the number of a particular days in a month * Requires...: The number of the day in question (see DOW() docs for numbering) * The month in question (1-12) * the year in question (to account for leap years) * Changes....: lParameters tnDayNumber, tnMonth, tnYear local ldFirstDay, lnDOWFirstDay, ldLastDay, lnDOWLastDay, lnDaysInMonth ldFirstDay = date(tnYear, tnMonth, 1) ldLastDay = gomonth(ldFirstDay, 1) - 1 lnDOWFirstDay = DOW(ldFirstDay) lnDOWLastDay = DOW(ldLastDay) lnDaysInMonth = int(day(ldLastDay)/7) + ; iif(between(tnDayNumber + iif(tnDayNumber < lnDOWFirstDay, 7, 0), lnDOWFirstDay, lnDOWLastDay + iif(lnDOWLastDay < lnDOWFirstDay, 7, 0)), 1, 0) return lnDaysInMonthCheers,