Working with Dates in IBM BPM
Many of us (ibm bpm developers) are wondering on perform certain operation like comparing dates, find difference between dates and such stuff as Date not a simple type but is complex system object. But thanks to bpm suite, the implementation to do these operations are all already in place and if we give simple syntax which we use with simple types it will do the job. Here a some of the operations which I would like to illustrate in this post.
How to Comparing date1 and date2 ?
Comparing dates is as simple as comparing two integers.
Suppose I have two date variables tw.local.date1 and tw.local.date2 .
In order to compare dates we just have to use the statements as shown below.
tw.local.date1 > tw.local.date2 or
tw.local.date1 < tw.local.date2
Above statement will be evaluated to true or false in the similar way when used with integers.
Above statements will consider time stamp as well. If you want to check this irrespective of time, then first set the hours, min and seconds for these dates to same values and then compare. You have to first set hours, seconds and then milliseconds.
How to Compare date to current date ?
For this, first we need to get the current date and store it in a variable.
var currentDate= new TWDate();
then set currentDate and tw.local.date hours , seconds and milliseconds to same value and then compare like above.
How to Comparing date1 and date2 ?
Comparing dates is as simple as comparing two integers.
Suppose I have two date variables tw.local.date1 and tw.local.date2 .
In order to compare dates we just have to use the statements as shown below.
tw.local.date1 > tw.local.date2 or
tw.local.date1 < tw.local.date2
Above statement will be evaluated to true or false in the similar way when used with integers.
Above statements will consider time stamp as well. If you want to check this irrespective of time, then first set the hours, min and seconds for these dates to same values and then compare. You have to first set hours, seconds and then milliseconds.
How to Compare date to current date ?
For this, first we need to get the current date and store it in a variable.
var currentDate= new TWDate();
then set currentDate and tw.local.date hours , seconds and milliseconds to same value and then compare like above.