Possible Duplicates:
Calculating difference in dates in Java
How can I calculate a time span in Java and format the output?
Say you were given two dates as strings and they are in this format 8/11/11 9:16:36 PM
how would I go about converting them to java Date objects so that I can then calculate the difference between two dates?
define a SimpleDateFormat matching your format (the java doc is pretty straighforward), then use the parse method to get a the proper Date object, from which you can easily compute the difference between the two dates. Once you have this difference, the best is probably to compute "manually" the number of days / hours / minutes / seconds, although it might be possible to again use a SimpleDateFormat (or some other formatting mechanism) to display the proper values in a generic way.
The majority of Date's getters are deprecated, replaced with Calendar methods. Here's how you would do it
Then you can do whatever you like with those numbers.
As long as both times are in GMT/UTC, you can do
date1.getTime() - date2.getTime()
and then divide the result by 86400000 to get number of days. The rest is probably pretty intuitive.EDIT -- based on edited question
To convert Strings into dates, use the SimpleDateFormat class.