I have an Html page, user enters a Date (dd-mm-yyyy) here. There's a servlet connected in the backend for processing this submitted information, it must have a method to compare this entered date with the dates obtained from the backend table which again are retrieved as strings (dd-mm-yyyy). Can anyone suggest how to carry out comparision between these date strings?
Eg:
String Entered Date: "28-02-2007"
String Backend Date: "20-01-2006"
I need to have some function which tells me that the entered date is 1 year 1 month and 08 days ahead of the backend date.
Right now I am using StringTokenizer (EnteredDate,"-") and StringTokenizer (BackendDate,"-") to split these two strings and get their day, month, year stored in seperate variables and then I carry out the comparision between them in if-conditions. But is there any other way to directly compare these dates?
Eg:
String Entered Date: "28-02-2007"
String Backend Date: "20-01-2006"
I need to have some function which tells me that the entered date is 1 year 1 month and 08 days ahead of the backend date.
Right now I am using StringTokenizer (EnteredDate,"-") and StringTokenizer (BackendDate,"-") to split these two strings and get their day, month, year stored in seperate variables and then I carry out the comparision between them in if-conditions. But is there any other way to directly compare these dates?
Comment