I have been workign on that for sometime now...
Please find below my code....
public int removeWeekEnds(String plannedst, String plannedend)
{
if (plannedst.equals(""

) return 0;
StringTokenizer plstT = new StringTokenizer(plannedst,"/"

;
int plday =Integer.parseInt(plstT.nextToken());
int plmon =Integer.parseInt( plstT.nextToken());
int plyear =Integer.parseInt(plstT.nextToken());
Date plstDate = new Date(plyear+"/"+plmon+"/"+plday);
int pldayst = (int) ((plstDate.getTime()) / (1000 * 60 * 60 * 24));
if (plannedend.equals(""

) return 0;
StringTokenizer pldnT = new StringTokenizer(plannedend,"/"

;
int pldayen =Integer.parseInt(pldnT.nextToken());
int plmonen =Integer.parseInt(pldnT.nextToken());
int plyearen =Integer.parseInt(pldnT.nextToken());
Date plenDate = new Date(plyearen+"/"+plmonen+"/"+pldayen);
int pldayend = (int) ((plenDate.getTime()) / (1000 * 60 * 60 * 24));
esteffortint = (pldayend - pldayst)+1;
// This is the number of days between two days "esteffortint"
int x = esteffortint;
GregorianCalendar kc = new GregorianCalendar(plyear, plmon, plday);
for(int i=0; i<=x; i++)
{
plyear = kc.get(Calendar.YEAR);
plmon = kc.get(Calendar.MONTH);
plday = kc.get(Calendar.DATE);
int dayInWeek= kc.DAY_OF_WEEK;
if (dayInWeek ==1 || dayInWeek == 7)
{
esteffortint--;
}
kc.add(Calendar.DATE, 1);
kc.set(plyear,plmon,plday);
}
return esteffortint;
}
This is printing the wrong week of the day for me.... the number of days that it should return is 21 ...but as such the result i get is 22...
Can somebody plzz tell mewhere I am going wrong... i did try a lot of options.....