Let's say i have several TimeStamp objects and i want to know the difference between 2 of them in terms of minutes and seconds.
TimeStamp timestamp1 = new TimeStamp(System.currentTimeMillis());
TimeStamp timestamp2 = new TimeStamp(System.currentTimeMillis());
if i use the method getSeconds (but the concept can be adapted to minutes and hours too), for example, the expected output is "SS".
But when i try to get the difference between the 2 objects (something like:
long differenceInSeconds = (timestamp1.getseconds() - timestamp2.getSeconds());
Now the expected output is just the difference between 2 numbers, so clearly it can be 0, 5, 13, ...
What if i wanted to always have values formatted in XX? 0 would be 00, 13 would be 13 and going on.
Maybe there is some class, or method,regarding timestamp which i'am unaware of?