Compare dates


#1

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


#2

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")

Regards…!!
AKsh


Compare two dates
#3

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


#4

@ClaytonM and @aksh1yadav thank u for the sugg :blush: