# Compare Two Dates With Differing Formats

**URL:** <https://forum.uipath.com/t/compare-two-dates-with-differing-formats/15047>\
**Category:** Help\
**Tags:** studio, activities, system, uiautomation\
**Created:** [November 6, 2017, 4:46pm UTC](https://forum.uipath.com/t/compare-two-dates-with-differing-formats/15047 "2017-11-06T16:46:27Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [November 6, 2017, 5:32pm UTC](https://forum.uipath.com/t/compare-two-dates-with-differing-formats/15047/2 "2017-11-06T17:32:25Z")

</div>

> [@AutomateWork](#):
>
> Take Date From String and Compare to Todays Date and Allocate Difference in Days to a Var (This is where I need help)

Hey @AutomateWork

Have you gone through with this thread?

> [@Get difference between two dates?](https://forum.uipath.com/t/get-difference-between-two-dates/3965/8):
>
> Hey @prajakta well this is due to the date format you are passing. on your system it might be like MM/dd/yyyy(10/12/2017) better to check date format on your system write line Now.Date.Tostring and check. and from your excel you are getting like this 12-10-2017 i.e so format mismatching so you are getting wrong or negative result. if you will do like this it will return you 0. Convert.ToString((Now.Date - Now.Date).TotalDays) // write line it. Convert.ToString((Convert.ToDateTime(“10/…

Regards…!!  
Aksh

---

_[View the full topic](https://forum.uipath.com/t/compare-two-dates-with-differing-formats/15047)._
