XPages date only fieldonly

ぃ、小莉子 提交于 2019-12-18 09:04:24

问题


Is it possible to create a date only field in XPages? I have tried the following in the querySaveDocument event but the field still ends up with a time portion of 00:00:00

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

回答1:


Here is code by Sven:

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

error in date items, daylight Saving

Update:

I had to do the same thing and found out that it's working this way in Java agent in 8.5.2FP3:

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



回答2:


It is not completely clear what you are trying achieve.

You can put an EditBox component on your XPage, then go to the "Data" tab. From there you can change the formatting from String to Date. More options should appear on how to format the date in the field. It will handle passing the date to the back end document.

If it is you want to write directly to the back end document, then here is a page listing samples on working with NotesDateTime.

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



来源:https://stackoverflow.com/questions/14439726/xpages-date-only-fieldonly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!