Advertisement
Guest User

Untitled

a guest
May 25th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. /**
  2. *
  3. * @param other
  4. * zweite Zeit
  5. * @return true/ false, ob danach
  6. */
  7. public boolean isAfter(DateTimeBi other) {
  8. return (milliseconds >= other.milliseconds);
  9. }
  10.  
  11. /**
  12. *
  13. * @param other
  14. * zweite Zeit
  15. * @return true/ false, ob davor
  16. */
  17. public boolean isBefore(DateTimeBi other) {
  18. return (milliseconds <= other.milliseconds);
  19. }
  20.  
  21. /**
  22. * wie oben, nur wird jetzt lediglich noch auf den Tag/ Stunden/ etc. geschaut
  23. *
  24. * @param other
  25. * anderes Datum
  26. * @param ignoreWeek
  27. * woche soll außen vor gelassen werden
  28. * @return true/ false
  29. */
  30. public boolean isAfter(DateTimeBi other, boolean ignoreWeek) {
  31. long millinew = milliseconds;
  32. long othermilli = other.milliseconds;
  33. if (ignoreWeek) {
  34. millinew -= getYear() * YEARMILLI + getMonth() * MONTHMILLI + getWeeks() * WEEKMILLI;
  35. othermilli -= other.getYear() * YEARMILLI + other.getMonth() * MONTHMILLI + other.getWeeks() * WEEKMILLI;
  36. }
  37. return (millinew >= othermilli);
  38. }
  39.  
  40. /**
  41. * wie oben, nur wird jetzt lediglich noch auf den Tag/ Stunden/ etc. geschaut
  42. *
  43. * @param other
  44. * anderes Datum
  45. * @param ignoreWeek
  46. * woche soll außen vor gelassen werden
  47. * @return true/ false
  48. */
  49. public boolean isBefore(DateTimeBi other, boolean ignoreWeek) {
  50. long millinew = milliseconds;
  51. long othermilli = other.milliseconds;
  52. if (ignoreWeek) {
  53. millinew -= getYear() * YEARMILLI + getMonth() * MONTHMILLI + getWeeks() * WEEKMILLI;
  54. othermilli -= other.getYear() * YEARMILLI + other.getMonth() * MONTHMILLI + other.getWeeks() * WEEKMILLI;
  55. }
  56. // if (milliseconds < other.milliseconds) {
  57. // return true;
  58. // }else if(milliseconds == other.milliseconds){
  59. // return true;
  60. // }else {
  61. // return false;
  62. // }
  63.  
  64. return (millinew <= othermilli);
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement