Reputation: 53
I have 2 dates in string format like DD/MM/YYYY
. Now I have to write the condition if date1
is before date2
. How can I do this? Please help me.
Upvotes: 3
Views: 4978
Reputation: 57573
Try this:
SimpleDateFormat curFormater = new SimpleDateFormat("dd/MM/yyyy");
Date date1 = curFormater.parse(date1Str);
Date date2 = curFormater.parse(date2Str);
if (date1.before(date2))
{
}
Upvotes: 9