Display hours between 2 dates in java
问题 i have this code, i need show only hours:min:sec, any help? String var = "1429174464829"; (this is time in System.currentTimeMillis() ) String p = "HH:mm:ss"; SimpleDateFormat f = new SimpleDateFormat(p); long t = var - System.currentTimeMillis(); String result = f.format(new Date(t)); in example String var, is 1 hours higher than System.currentTimeMillis() result problem EDIT: i obtain: result = 21:59:00 thanks 回答1: Java 8 Okay, this is a little unpleasant, but will get the job done, this is