public int getWeekNo(Calendar cal, int weekStartOn) {if (weekStartOn == 1) {cal.setFirstDayOfWeek(Calendar.SUNDAY);} else {cal.setFirstDayOfWeek(Calendar.MONDAY);}return cal.get(Calendar.WEEK_OF_YEAR);}
public int getWeekNo(DateTime dt, int weekStartOn){GregorianCalendar cal = new GregorianCalendar();int weekOfYear;if (weekStartOn == 1){weekOfYear = cal.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);}else{weekOfYear = cal.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);}return weekOfYear;}