Hi, I just want to measure the time taken for the completion of process to the finest millisecond possible. Say, Start time, End time. Time difference.. If it is run as a batch process, then the time difference will be accumulated and be printed at the end. Which is the best method to implement this? Please reply ASAP Thanks & Regards, Nijeesh.
Hi David, This is what I was looking for except for the fact the difference is being returned in milliseconds. Do I have to divide and multiply to get it converted into hours/seconds/minutes.. or is it possible to do the same with some format specifier? Thanks for your reply.. Regards, Nijeesh.
Hi - If you use the long (timeDifference) in the above code like: Date d = new Date(timeDifference); then d will be some number of months, days, hours, minutes, seconds, .... since Jan 1, 1970. Ignore the year, and just look at the other fields for the elapsed time. Alternatively, there is an open source implementation of ISO8601 dates being done on sourceforge (the Joda project). Date arithmetic is reasonably straight forward. You might take a look at that. HTH, Guy
Every plan is a little cooler if you have a blimp. And a tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss