I have to perform a search in a table:
1. It has Date(java.sql.Date)
2. It has a description field with entry like: "Dual Objective Case to be discussed"
3. other fields.
My issues are:
1. When I try to search for a date, and enter the string "10/10/2005" in the search field and click Search button, even though there are entries, it cannot find it. Mainly because of differences in the date format. I understand java.sql.Date has the format yyyy-mm-dd. How do I resolve this problem?
2. When I give my search term as "Objective", i have to find the entry/entries in which the term "Objective" appears - irrespective of the position of the word in the description sentence. How can I achieve this?
Uma Maheswari Soundara Pandian replied
1. Try extracting the date,month and year from your string "10/10/2005" and use Date class constructor as
Date searchDate = new Date(int year,int month,int date)
2. Get each descriptions in a loop, use indexOf("Objective") function on the description, if the indexOf returns -1 , then it means this particular decription doesnt have Objective. Repeat this for all the descriptions. This is one possible way, but not an efficient one.