Created
January 20, 2018 08:43
-
-
Save abdurahmanadilovic/7a59361ab767a8e4c9e6c941f7eb5eb7 to your computer and use it in GitHub Desktop.
Pretty minutes ago formatter for Calendar bject
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PrettyFormatCalendar{ | |
private Calendar before; | |
public PrettyFormatCalendar(Calendar before) { | |
this.before = before; | |
} | |
public long minutesAgoFrom(Calendar other){ | |
long diff = other.getTimeInMillis() - before.getTimeInMillis(); | |
return TimeUnit.MILLISECONDS.toMinutes(diff); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment