I want to find out the elapsed date for example, if I have two dates I want to find out the difference between them in days. Can this be done? If yes can anyone send me the code this is really urgent.
This is a very easy problem. If you have two dates, and you know the date that occurs later, simply subtract the time of the other date from the later date.
Date now = new Date(System.currentTimeMillis());
Date later = new Date(System.currentTimeMillis());
long diff = later.getTime() - now.getTime();
You can divide 'diff' by the number of milliseconds per day, to get the difference in days, or by the number of milliseconds per hour, to get the differnce in hours, etc, you get the idea.
If using the precise difference in milliseconds won't work for you, there are utility methods in the java.util.Calendar class for determine the difference between two dates.