Problem trying to do a Java db.search against a date field

Hi,

I am trying to do a db.search (Java code) where the field in the database is a Date field formated as “MM/dd/yyyy”. The following code show many way’s I have tried to get the Java string variable to somehow be compatible with the Notes field but I keep coming up with 0 rows found when I know there are 2.

The date in runSDate is “06/01/2008”. In the Notes DB I have two records, one with date “06/14/2008” and the other with “06/17/2008”. I cannot seem to get the db.search to correctly find the 2 records.

		session = getSession();

		agentContext = session.getAgentContext();

		db = agentContext.getCurrentDatabase();



		DateTime dtNew = session.createDateTime(runSDate);

// SimpleDateFormat iPut = new SimpleDateFormat(“MM/dd/yyyy”);

// Date rdt = new Date();

// rdt = iPut.parse(runSDate);

// Calendar cal = Calendar.getInstance();

// cal.setTime(runSDate);

		String tttt = "expdate > \"" + dtNew + "\"";

		print("---- Searching for: " + tttt);

		docColl = db.search(tttt);

		

		if (docColl.getCount() == 0) {

			print("|||| No Documents to process!!!");

			return;

		}

Thanks in advance…

Glen

Subject: problem trying to do a Java db.search against a date field.

Try placing square brackets around your date. Something like this:

String tttt = “expdate > [” + dtNew + “]”;

So the Search method should end up reading your search string as “expdate > [06/01/2008]”.

Hope that helps.