But if you don't know what the format of the second date is, it is going to be very hard. The computer can't magically figure that out for you... Note that dates can be written in ambiguous ways: for example, does "01/03/10" mean 1 March 2010, 3 January 2010 or maybe even 10 March 2001?
Once you have the dates as Date objects, you can use methods such as after() and before() on the Date objects (again, lookup the API documentation) to compare them.
The main question is, why don't you know the second format? Where is this date coming from? If it is from user input, simply limit the user to a format you know. You can even allow a select group of formats. For instance:
tushartrue fasate wrote:Thanks for reply.
But this is the case i want.
Is there any other suggestions...?
First you have to answer the following question for yourself: What are you going to do if you get for example "01/03/10" for the second date? You'll have to decide for yourself how that should be handled; we can't tell you, because we don't know the requirements for the program you're writing. Without an answer to that question, it makes no sense to ask for Java code.