private String duration(int ms) { Date date = new Date(ms); if (date.getHours() - 8 < 1) { int a=date.getMinutes()/10; int b=date.getMinutes()%10; int c=date.getSeconds()/10; int d=date.getSeconds()%10; mDuration=a+b+":"+c+d; }else { int h=date.getHours()-8; int a=date.getMinutes()/10; int b=date.getMinutes()%10; int c=date.getSeconds()/10; int d=date.getSeconds()%10; mDuration=h+":"+a+b+":"+c+d; } return mDuration; }