Set Java Date object from notes datetime object
Manipulating the date will bring me some problems
I created some java code that reads the document from the Notes database and fills some fields in the Java object with the values in the Notes document The Notes document contains the DataTime field "exppaydate", which I want to store in the Java object, but there is a syntax error in the java editor My code looks like this:
for (int n = 1 ; n < col.getCount(); n++){ Document pDoc = col.getNthDocument(n); PaymentItem pItem = new PaymentItem(); Date pDate = pDoc.getItemValue("ExpPayDate")[0]; pItem.setExpPayDate(pDate); . . . pDoc.recycle(); }
I have tried various methods to get the value from PDOC getitemvalue getitemvaluedatetime. The above code gives a snytax error "type od expression must be bean array type, but it resolves to vector". If I delete [0], the error is "type mismatch, unable to convert vector to date". I guess I missed some very simple things, but I'm sorry at the moment
Solution
Use datetime toJavaDate(). It converts Domino's datetime value to Java util. Date.
DateTime dateTime = (DateTime) pDoc.getItemValueDateTimeArray("ExpPayDate").get(0); Date pDate = dateTime.toJavaDate();