I was just wondering if there is a need of TimeSpan in java.util
so that I can define how much hours,minutes and seconds are there in between these two times.
From this TimeSpan
we can have a time interval between two times. like
TimeSpan getTimeSpan( Date before, Date after ){...}
or
long timeSpan = System.currentTimeMillis();
// ... long job
timeSpan = System.currentTimeMillis() - timeSpan;
TimeSpan ts = new TimeSpan(timeSpan);
and with this TimeSpan
we can use it in SimpleDateFormat
.
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
format.format( timsSpan );
I am not sure if this is already been implemented in Java but yet undiscovered by me.
JodaTime
'sInterval
. But I wonder why not in standard library has yet came up with such utility. Since the usage is very common. – Bestraddle