Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1.                     Date commitDate=new SimpleDateFormat("MM/yyyy").parse(commitDateString);  
  2.                     Date firstCommit=new SimpleDateFormat("MM/yyyy").parse(startDate);
  3.                     Date lastCommit = new SimpleDateFormat("MM/yyyy").parse(endDate);
  4.                    
  5.                     calFirstCommit.setTime(firstCommit);
  6.                     calLastCommit.setTime(lastCommit);
  7.                     calCommit.setTime(commitDate);
  8.                    
  9.                     int monthsDiff = 12*(calLastCommit.get(Calendar.YEAR)-calFirstCommit.get(Calendar.YEAR)) + (calLastCommit.get(Calendar.MONTH) - calFirstCommit.get(Calendar.MONTH));
  10.                     calFirstCommit.add(Calendar.MONTH, (monthsDiff/2) - 1);
  11.                     calLastCommit.setTime(firstCommit);
  12.                     calLastCommit.add(Calendar.MONTH,  (monthsDiff/2));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement