Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. public int differenceInYears(MyDate comparedDate)
  2. {
  3. int retVal = 0;
  4.  
  5. int zile_an_curent = (this.month - 1) * 30 + this.day;
  6. int zile_an_comparat = (compared.month - 1) * 30 + compared.day;
  7. int suma_zile = (( 365 - zile_an_curent) + zile_an_comparat );
  8.  
  9. if ( suma_zile >= 365 )
  10. {
  11.  
  12. retVal = (suma_zile / 365) * math.abs(this.year - compared.year);
  13.  
  14. }
  15.  
  16. return retVal;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement