# Compare dates

**URL:** <https://forum.uipath.com/t/compare-dates/6223>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [June 13, 2017, 12:19pm UTC](https://forum.uipath.com/t/compare-dates/6223 "2017-06-13T12:19:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![renjith\_krishnan](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@renjith\_krishnan](https://forum.uipath.com/u/renjith_krishnan)\
**Post date:** [June 13, 2017, 12:19pm UTC](https://forum.uipath.com/t/compare-dates/6223/1 "2017-06-13T12:19:08Z")

</div>

How to compare dates of the following format  
10-Apr-2017 and 15-Apr-2017

---

<div class="post-metadata">

**Author:** ![aksh1yadav](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/aksh1yadav/32/135359_2.png) [@aksh1yadav](https://forum.uipath.com/u/aksh1yadav)\
**Post date:** [June 13, 2017, 12:45pm UTC](https://forum.uipath.com/t/compare-dates/6223/2 "2017-06-13T12:45:40Z")

</div>

Hey @ranjith

Hope those dates are in string format if so then compare them to datetime first convert them into datetime then use “Compare Date” Activity.

or if already they are available in Datetime format then directly pass those values to “Compare Date” Activity.

```
System.Datetime date1=Convert.ToDateTime("10-Apr-2017");

System.Datetime date2 =Convert.ToDateTime("15-Apr-2017")

```

 ![](https://global.discourse-cdn.com/uipath/original/2X/6/67dccf1d87d2342269229f7d1d7715559572a7e8.png)

Regards…!!  
AKsh

---

<div class="post-metadata">

**Author:** ![ClaytonM](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/claytonm/32/555957_2.png) [@ClaytonM](https://forum.uipath.com/u/ClaytonM)\
**Post date:** [June 13, 2017, 2:05pm UTC](https://forum.uipath.com/t/compare-dates/6223/3 "2017-06-13T14:05:13Z")

</div>

Similarly,  
If you just use Cdate which is same as Convert.ToDateTime then use -, +, or = in the conditions.

For examples,

**Cdate(“10-Apr-2017”) \> Cdate(“15-Apr-2017”)** will return False

**Cdate(“4/15/2017”) - Cdate(“4/10/2017”)** will return 5.00:00:00 or 5 days as a timespan

---

<div class="post-metadata">

**Author:** ![renjith\_krishnan](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@renjith\_krishnan](https://forum.uipath.com/u/renjith_krishnan)\
**Post date:** [June 14, 2017, 5:40am UTC](https://forum.uipath.com/t/compare-dates/6223/4 "2017-06-14T05:40:07Z")

</div>

@ClaytonM and @aksh1yadav thank u for the sugg 😊

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [October 29, 2018, 9:27am UTC](https://forum.uipath.com/t/compare-dates/6223/5 "2018-10-29T09:27:55Z")

</div>


