How to subtract days from a date in TIBCO BusinessEvents?

How to subtract days from a date in TIBCO BusinessEvents?

book

Article ID: KB0093938

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Resolution:
Description:
============
How to substract days from a date in Tibco BusinessEvents?

Environment:
===========
All O/S and H/W
TIBCO BusinessEvents – All versions.

Resolution:
==========
You can use any of the following 2 approaches

**************
long d1 = DateTime.getTimeInMillis(DateTime d); // Converting DateTime into milliseconds from which you want to subtract days.

long oneDay = 1000 * 60 * 60 * 24; //One day in milliseconds

long d2 = (number of days to be subtracted)*oneDay; //number of days to subtract in milliseconds

long d3 = d1-d2;

DateTime resultDate = DateTime.parseLong(d3);
**************

OR

**************
Int noDays = 15;

DateTime d2 = DateTime.addDay(d1, (noDays * -1));
**************

Issue/Introduction

How to subtract days from a date in TIBCO BusinessEvents?