XPages date is only useful

Is it possible to create a date field in XPages only? I tried the following on the querySaveDocument event, but the time part of 00:00:00 still ends in the field

var notesDoc:NotesDocument = document1.getDocument();
var dt:NotesDateTime = session.createDateTime(@Today());
dt.setAnyTime();
notesDoc.replaceItemValue("MyDateField", dt);

      

+3


source to share


2 answers


Here is Sven's code:

ndt = session.createDateTime(ndt.getDateOnly());
item.setDateTimeValue(ndt);

      

error in date elements, daylight saving time



Update:

I had to do the same and found out that it works this way in the Java Agent in 8.5.2FP3:

DateTime dt = session.createDateTime(new java.util.Date());
dt.setAnyTime();
doc.appendItemValue("DT", dt);

      

+2


source


It is not entirely clear what you are trying to achieve.

You can put the EditBox component in the XPage and then go to the Data tab. From there, you can change the formatting from String to Date. There should be more options on how to format the date in the field. It will handle passing the date to the back document.

Data Properties Tab



If you want to write directly to the back document, here are examples of page listing when working with NotesDateTime.

http://www-10.lotus.com/ldd/ddwiki.nsf/dx/NotesDateTime_sample_JavaScript_code_for_XPages

+3


source







All Articles