Calculating the difference between two dates in BusinessEvents(BE).

Calculating the difference between two dates in BusinessEvents(BE).

book

Article ID: KB0088327

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Resolution:
Description:
============
Calculating the difference between two dates in BusinessEvents(BE)
              OR
Is there a function in BusinessEvents(BE) that calculates the difference between two dates?


Environment:
==========

   o TIBCO BusinessEvents 3.0.1

   o TIBCO Designer



Resolution:
==========
BusinessEvents does not have functions to directly calculate the difference between two dates. However, you can use the following approach which uses existing DateTime functions available in BE to calculate the difference between two dates.


===================================================================================
long d1 = DateTime.getTimeInMillis(DateTime.createTime(2010,1,1,0,0,0,null));

long d2 = DateTime.getTimeInMillis(DateTime.createTime(2010,3,1,0,0,0,null));

long d3 = d2-d1;

long oneDay = 1000 * 60 * 60 * 24;

long differenceInDays = d3/oneDay;
===================================================================================

Issue/Introduction

Calculating the difference between two dates in BusinessEvents(BE).