Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lotus notes search by date with Java api

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?

like image 740
grooble Avatar asked Jun 07 '26 19:06

grooble


1 Answers

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.

like image 182
Ken Pespisa Avatar answered Jun 09 '26 07:06

Ken Pespisa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!