tags:

views:

77

answers:

1

basically i have one time

currentTime = DateFormat.getTimeInstance().format(new Date());

and i want to calculate how much time has past since currentTime. any ideas?

+1  A: 

Your currentTime as above will be a String, so difficult to work with.

If you use a Date object instead:

Date interestingDate = new Date();

then you can find the different in milliseconds between the actual current date and interestingDate by doing:

(new Date()).getTime() - interestingDate.getTime()

Also check out the Time class which you could use instead of the Date class.

oli
thanks, worked like a charm
Simon