IDEMPIERE-2011 get a date according to saturday/sunday and non business days / based on patch from Nicolas Micoud (nmicoud)
This commit is contained in:
parent
7815708472
commit
e879b18def
|
@ -815,4 +815,18 @@ public class TimeUtil
|
||||||
return endCal.get(Calendar.YEAR) * 12 + endCal.get(Calendar.MONTH)
|
return endCal.get(Calendar.YEAR) * 12 + endCal.get(Calendar.MONTH)
|
||||||
- (startCal.get(Calendar.YEAR) * 12 + startCal.get(Calendar.MONTH));
|
- (startCal.get(Calendar.YEAR) * 12 + startCal.get(Calendar.MONTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns start date + nbDays which cannot be saturday or sunday or non business days */
|
||||||
|
public static Timestamp addOnlyBusinessDays(Timestamp startDate, int nbDays, int clientID, String trxName)
|
||||||
|
{
|
||||||
|
Timestamp retValue = startDate;
|
||||||
|
while (nbDays > 0) {
|
||||||
|
retValue = TimeUtil.addDays(retValue, 1);
|
||||||
|
StringBuilder sql = new StringBuilder("SELECT nextBusinessDay(?,?) FROM DUAL");
|
||||||
|
retValue = DB.getSQLValueTSEx(trxName, sql.toString(), retValue, clientID);
|
||||||
|
nbDays--;
|
||||||
|
}
|
||||||
|
return retValue;
|
||||||
|
}
|
||||||
|
|
||||||
} // TimeUtil
|
} // TimeUtil
|
||||||
|
|
Loading…
Reference in New Issue