Code example for TimeUnit

Methods: toSeconds

0
		} 
		 
		// Calculate time from now to end 
		long diffInMis = end.toMillis(false) - now.toMillis(false);
		 
		long diff = TimeUnit.MILLISECONDS.toSeconds(diffInMis);
		 
		iHour = (int) (diff/3600);
		long lhour = (diff % (3600));
		 
		iMin = (int) (lhour/60);
		long lmin = (lhour % (60));
		 
		iSec = (int) (lmin);
		 
		hour.setText(String.valueOf(twoDigitNumFormat.format(iHour)).toString());
		min.setText(":" + String.valueOf(twoDigitNumFormat.format(iMin)).toString());
		sec.setText(":" + String.valueOf(twoDigitNumFormat.format(iSec)).toString());
		 
		counter = new MyCount(iSec*1000, 1000);