Android Utililty Methods Timestamp Compare

List of utility methods to do Timestamp Compare

Description

The list of methods to do Timestamp Compare are organized into topic(s).

Method

booleanafter(Timestamp t1, Timestamp t2)
after
if (t1 == null || t2 == null) {
    return false;
return t1.after(t2);
booleanbefore(Timestamp t1, Timestamp t2)
before
if (t1 == null || t2 == null) {
    return false;
return t1.before(t2);
intcompare(Timestamp t1, Timestamp t2, int what)
compare
Calendar c1 = Calendar.getInstance();
c1.setTime(t1);
Calendar c2 = Calendar.getInstance();
c2.setTime(t2);
int number = 0;
switch (what) {
case Calendar.YEAR:
    number = c1.get(Calendar.YEAR) - c2.get(Calendar.YEAR);
...
booleanequals(Timestamp t1, Timestamp t2)
equals
if (t1 == null && t2 == null) {
    return true;
} else {
    if (t1 == null) {
        return t2.equals(t1);
    } else {
        return t1.equals(t2);