Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Date commitDate=new SimpleDateFormat("MM/yyyy").parse(commitDateString);
- Date firstCommit=new SimpleDateFormat("MM/yyyy").parse(startDate);
- Date lastCommit = new SimpleDateFormat("MM/yyyy").parse(endDate);
- calFirstCommit.setTime(firstCommit);
- calLastCommit.setTime(lastCommit);
- calCommit.setTime(commitDate);
- int monthsDiff = 12*(calLastCommit.get(Calendar.YEAR)-calFirstCommit.get(Calendar.YEAR)) + (calLastCommit.get(Calendar.MONTH) - calFirstCommit.get(Calendar.MONTH));
- calFirstCommit.add(Calendar.MONTH, (monthsDiff/2) - 1);
- calLastCommit.setTime(firstCommit);
- calLastCommit.add(Calendar.MONTH, (monthsDiff/2));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement