book
Article ID: KB0086763
calendar_today
Updated On:
Description
Resolution:
Description:
===========
How to use the DateTime comparison in queries and how to compare two dates in a query to get data from the Cache?
Environment:
===========
TIBCO BusinessEvents 3.x
All Operating Systems
Resolution:
========
We can compare the two dates ONLY after converting both of them to MilliSeconds.
For example, suppose we want to implement the query to get all the records between fromTime and toTime for a Concept Trade which has dateVar as DateTime property.
1). Query will look like ->
Select B.counterpartyId from /ConceptModel/Trade B where /#DateTime/getTimeInMillis(B.dateVar) > $fromTime and /#DateTime/getTimeInMillis(B.dateVar) < $toTime
2). Also for setting the variables in statement -
Query.Statement.setVar(stmntName,"fromTime" ,DateTime.getTimeInMillis(DateTime.createTime(2008,9,27,0,0,0,null)));
Query.Statement.setVar(stmntName,"toTime",DateTime.getTimeInMillis(DateTime.createTime(2008,11,25,23,59,59,null)));
3). Also note that months start from 0, so Jan- 0,...Jun - 5.........Dec - 11
Issue/Introduction
How to use the DateTime comparison in queries and how to compare two dates in a query to get data from the Cache ?