# How to compare date in Groovy Script

**URL:** <https://forum.flowable.org/t/how-to-compare-date-in-groovy-script/12624>\
**Category:** Uncategorized\
**Created:** [September 17, 2026, 6:56pm UTC](https://forum.flowable.org/t/how-to-compare-date-in-groovy-script/12624 "2026-09-17T18:56:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shatdal](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@Shatdal](https://forum.flowable.org/u/Shatdal)\
**Post date:** [September 17, 2026, 6:56pm UTC](https://forum.flowable.org/t/how-to-compare-date-in-groovy-script/12624/1 "2026-09-17T18:56:33Z")

</div>

I have to compare two dates in groovy script. Both date will read through getVariable function. I an not able to compare of not able to format it.

Need help

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [September 18, 2026, 12:04pm UTC](https://forum.flowable.org/t/how-to-compare-date-in-groovy-script/12624/2 "2026-09-18T12:04:36Z")

</div>

```auto
date1.compareTo(date2)

```
