我想用修改后的日期查询 RTC。我的查询是检查修改日期是否与给定日期和时间相同,但我得到的响应是基于给定日期的,它忽略了时间。
回复:
查询日期:08/07/2015 15:44:09
ID:2583 修改日期:2015-08-07 14:43:19.157
ID:2582 修改日期:2015-08-07 14:43:19.419
理想情况下,不应像在给定时间之前那样收到这两个记录作为响应。
下面是我的代码:
IQueryableAttributeFactory factory = QueryableAttributes.getFactory( IWorkItem.ITEM_TYPE );
IQueryableAttribute recAttr1 = factory.findAttribute(projectArea, IItem.MODIFIED_PROPERTY, auditableClient, null );
IQueryableAttribute recAttr2 = factory.findAttribute(projectArea, IWorkItem.TYPE_PROPERTY, auditableClient, null );
Date date = new Date();
date.setDate(date.getDate()-6);
DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
String reportDate = df.format(date);
System.out.println("Date: "+reportDate);
Timestamp timeStamp = new Timestamp(date.getTime());
AttributeExpression recExpr1 = new AttributeExpression(recAttr1, AttributeOperation.EQUALS, timeStamp );
Term term= new Term(Operator.AND);
term.add(recExpr1);
IQueryClient queryClient = (IQueryClient) teamRepository.getClientLibrary(IQueryClient.class);
IQueryResult<IResolvedResult<IWorkItem>> result = queryClient.getResolvedExpressionResults(projectArea, (Expression)term, IWorkItem.FULL_PROFILE);
System.out.println("This is total number: "+result.getResultSize(monitor).getTotal()+"\n");
while(result.hasNext(null)){
IResolvedResult<IWorkItem> resolvedWorkItem = result.next(null);
IWorkItem workItem = resolvedWorkItem.getItem();
Date date1 = resolvedWorkItem.getItem().modified();
System.out.println("Id: "+workItem.getId());
System.out.println("Modified date :"+date1.toString()+"\n");
}
我可以不仅根据日期而且根据时间获得结果吗?
我强烈感觉RTC的后端逻辑是完全无视时间,只根据日期查询数据库。