Skip to content

Instantly share code, notes, and snippets.

@abdurahmanadilovic
Created January 20, 2018 08:43
Show Gist options
  • Save abdurahmanadilovic/7a59361ab767a8e4c9e6c941f7eb5eb7 to your computer and use it in GitHub Desktop.
Save abdurahmanadilovic/7a59361ab767a8e4c9e6c941f7eb5eb7 to your computer and use it in GitHub Desktop.
Pretty minutes ago formatter for Calendar bject
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