xpages日期比较

时间:2015-05-15 14:22:49

标签: datetime xpages xpages-ssjs

您好我想为平面视图编写Style ssjs。在列日期变量" 01.06.2007"上设置如果文档开始日期+持续时间包含01.06.2007,则结果为背景颜色更改。

DateConverter.stringToDate = Java.util.date Tommy Valand代码。 (http://dontpanic82.blogspot.com.tr/2010/04/xpages-code-snippet-for-datestring.html

// --------------------------------------------- ----     col = 0;

var zeroDate = DateConverter.stringToDate( '01.06.2007', 'dd.MM.yyyy' ) 

colDate = @Adjust(zeroDate, 0, 0, col, 0, 0, 0);

duration = parseInt(rowData.getColumnValue("Duration"));

startDate = rowData.getColumnValue("Start Date");

endDate = @Adjust(startDate, 0, 0, (duration-1), 0, 0, 0);

if(startDate == colDate){
"startColor"}else if(startDate < coldate && (colDate < endDate)){
"perColor"}else{
"bgColor"}`

1 个答案:

答案 0 :(得分:2)

您无法将日期值与&lt;或者&gt;据我所知。将NotesDateTime内容转换为Java日期对象,并使用before()和after()方法。 像

var startDate:NotesDateTime = ... ;
if(startDate.toJavaDate().before(colDate.toJavaDate()) && ... ){
...
}