Usage:
new CountUpTimer(1000L) { @Override public void onTick(long millisElapsed) { Date date = new Date(millisElapsed); DateFormat dateFormat = new SimpleDateFormat(TimeUnit.MILLISECONDS.toHours(millisElapsed) >= 1 ? "HH:mm:ss" : "mm:ss"); Log.i(dateFormat.format(date)); } };