# Date Based Rules

**URL:** <https://forum.flowable.org/t/date-based-rules/6998>\
**Category:** Flowable Engine\
**Created:** [October 30, 2020, 1:24pm UTC](https://forum.flowable.org/t/date-based-rules/6998 "2020-10-30T13:24:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yougal](https://avatars.discourse-cdn.com/v4/letter/y/c4cdca/32.png) [@Yougal](https://forum.flowable.org/u/Yougal)\
**Post date:** [October 30, 2020, 1:24pm UTC](https://forum.flowable.org/t/date-based-rules/6998/1 "2020-10-30T13:24:24Z")

</div>

Hello,

We are trying to implement date based rules on Decision Table in Flowable DMN,  
for e.g current date- start date \> 2 or any two date comparison,

Any suggestions or links I can use to implement these rules?

Thanks in advance,  
Yougal BISHT

---

<div class="post-metadata">

**Author:** ![yvo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/yvo/32/2231_2.png) [@yvo](https://forum.flowable.org/u/yvo)\
**Post date:** [October 30, 2020, 1:57pm UTC](https://forum.flowable.org/t/date-based-rules/6998/2 "2020-10-30T13:57:08Z")

</div>

If you want an input (date) variable to be compared with a static date defined in a rule you can do something like this;

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/flowable/original/2X/4/4aeaab115cc611f2a692eaf2650148fd15036fa7.png)

Or you could use custom (JUEL) expressions and make use of some build in helpers;

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/flowable/original/2X/2/2b2aa23f75f0596c13873ff9cccb92079cc11fc3.png)

For instance; with `date:toDate()` you create a Date instance which you can use in the the expression.  
Also; `date:now()` creates a current date Date instance.

Hope this helps.

Regards,

Yvo

---

<div class="post-metadata">

**Author:** ![pardeep131085](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@pardeep131085](https://forum.flowable.org/u/pardeep131085)\
**Post date:** [October 30, 2020, 8:40pm UTC](https://forum.flowable.org/t/date-based-rules/6998/3 "2020-10-30T20:40:36Z")

</div>

Hi @yvo,

Lets says input variable startDate=‘2020-01-01’ and I wanted check that difference between start date and current date \> 30. How would the expression gonna looks like?

Like this:

${date:now() - startDate \>30}

${date:now() - date:toDate(startDate) \>30}

---

<div class="post-metadata">

**Author:** ![pardeep131085](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@pardeep131085](https://forum.flowable.org/u/pardeep131085)\
**Post date:** [November 1, 2020, 11:01pm UTC](https://forum.flowable.org/t/date-based-rules/6998/4 "2020-11-01T23:01:15Z")

</div>

Can we get any documentation for custom (JUEL) expressions which can be use in Rule tables?

---

<div class="post-metadata">

**Author:** ![yvo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/yvo/32/2231_2.png) [@yvo](https://forum.flowable.org/u/yvo)\
**Post date:** [November 2, 2020, 8:46am UTC](https://forum.flowable.org/t/date-based-rules/6998/5 "2020-11-02T08:46:06Z")

</div>

> Blockquote  
> Can we get any documentation for custom (JUEL) expressions which can be use in Rule tables?

The default / included function delegates can be found here; [repo](https://github.com/flowable/flowable-engine/tree/master/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/el)

This can be expanded though. Have a look in the [documentation](https://flowable.com/open-source/docs/dmn/ch02-Configuration/#custom-flowable-function-delegates) to see how.

As for the date expression; you could do something like this; comparing two dates;

```auto
${date:addDate(startDate,0,0,30) < date:now()} //add 30 days to startDate and do a comparison between dates

```

Regards,

Yvo
