lotus notes search by date with Java api
date, java, lotus-notes
Solution
You should get rid of the square brackets on the field name. The search method expects a Notes Formula, like what you'd put into a view selection formula:
"Date > [03/20/2012]"
It might also be required that dates are in mm/dd/yyyy format, though if you are in a non-US locale I'm not 100% sure.
Problem
I'm trying to select records by date from a Lotus Notes database and have run into trouble with correctly formatting the date. Here's the relevant code: ``` public void runNotes() { Session s; try { s = NotesFactory.createSession((String)null, (String)null, "mypassword"); Database hkDB = s.getDatabase("NBHDH001/YNM", "H\\DHH00001.nsf", false); DocumentCollection docs = hkDB.search("[Date]>[2012/03/20]"); ``` Date is a field in the record, and when I looked up records (with FTSearch), the date came back in the format above: [yyyy/mm/dd]. The parameter of the search is what I need here. i.e. what should I put instead of "[Date]>[2012/03/20]" I tried various constructions with Calendar and DateFormat, but it's not coming together... Any suggestions?