How to define TIBCO ActiveSpaces query (AS.Query) with dateTime values in where clause with current timestamp

How to define TIBCO ActiveSpaces query (AS.Query) with dateTime values in where clause with current timestamp

book

Article ID: KB0081500

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition 5.x

Description

A TIBCO ActiveSpaces query (AS.Query) with dateTime values in where clause with current timestamp in TIBCO BusinessEvents returns wrong results when timestamp defined with local timezone.

Issue/Introduction

Usage of TIBCO ActiveSpaces query (AS.Query) with dateTime values in where clause with current timestamp

Environment

All Operating Systems

Resolution

TIBCO ActiveSpaces stores DateTime values in GMT timezone to make it generic. 
The datetime value in the where clause (string) needs to be converted to GMT timezone to return correct results.

eg:
String sGMTimeZone = "UTC+00:00"; 
String scheduledDateTime  = DateTime.format(DateTime.translateTime(DateTime.now() , sGMTimeZone),"yyyy-MM-dd'T'HH:mm:ss"); 
Object [] tuples = AS.query("/Channels/AS/asDestination",null,"GET","SNAPSHOT","ALL",0,1000,"scheduledTime <=" + "'" + scheduledDateTime + "'" );

Additional Information

AS.query