Example #1
0
date dateUtil::adjustInvalidateDate(date aDate, bool forwardAdjust){
	int monthLastDay = getMonthLastDay(aDate.getYear(), aDate.getMonth());
	if (aDate.getDay()>monthLastDay){
		if (forwardAdjust){
			aDate.setMonth(aDate.getMonth()%12+1);
			aDate.setDay(1);
		}	else{
			aDate.setDay(monthLastDay);
		}
	}
	return aDate;
}
Example #2
0
date dateUtil::adjustInvalidateDate(date aDate, bool forwardAdjust){
	unsigned short monthlen[]={31,28,31,30,31,30,31,31,30,31,30,31};
	if (isleapyear(aDate.getYear()) && aDate.getMonth()==2)
		monthlen[1]++;
	if (aDate.getDay()>monthlen[aDate.getMonth()-1]){
		if (forwardAdjust){
			aDate.setMonth(aDate.getMonth()%12+1);
			aDate.setDay(1);
		}
		else
			aDate.setDay(monthlen[aDate.getMonth()-1]);
	}
	return aDate;
}