Hi Friends,
I have to calculate the difference between the dates.
e.g Start date :- 05/12/2011
End date;- 07/12/2012
then output should be:- 368 days.
then how i do in uipath.
Regards,
Hi Friends,
I have to calculate the difference between the dates.
e.g Start date :- 05/12/2011
End date;- 07/12/2012
then output should be:- 368 days.
then how i do in uipath.
Regards,
Hi @Rup_1
You can use the DateDiff.
Use following code(example)
DateDiff(DateInterval.Day, “05-12-2011”,“07/12/2012”)
this activity returns the number of days difference between 2 dates.
Hope It helps!
Regards,
Naveen
Hi,
It is correctly calculating but giving output in decimal numbers.
This will work
(EndDate.Date - StartDate.Date).TotalDays
I want output as a integer, number of days.
start date = 05/12/2011
End date = 07/12/2012
Create Variable of type (DateTime)
DateTimeStart = DateTime.Parse(start date)
DateTimeEnd = DateTime.Parse(End date)
MonthDifference Int type variable
MonthDifference = 12 * (DateTimeEnd.Year - DateTimeStart.Year) + DateTimeEnd.Month - DateTimeStart.Month
@Jayesh_678 Cheers
This is working correctly. Thanks for your quick response.
Most Welcome @Jayesh_678
Hi,
There is an issue. Bot is unable to calculate the date difference for 2020 dates. Till 2019 dates, it is calculating perfectly.
But i want the date diff for 2020 dates also.
Please guide me on this.
@ClaytonM
@Jayesh_678 What is the issue and how do you pass the date?
Hi,
Try Microsoft.Activities package:
You can put start date and end date (datetime variable) in properties and you will receive int as a diff between those two in output