Find Date Difference

Hi Team,

I have the below date inputs to find the date difference.

Input1 : Todays Date. Storing todays date as String [18/Jun/2020]
Input2 : Reading a date from excel. Storing it as String [20/Jun/2020]

Output should be : 2

Need sample lines of code.

Thanks

@Robotics Try this :
(DateTime.ParseExact(“20/Jun/2020”,“dd/MMM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)-DateTime.ParseExact(“18/Jun/2020”,“dd/MMM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)).Days

2 Likes

Use this below code to get the date difference, @Robotics
(Convert.ToDateTime(EndDate) - Convert.ToDateTime(StartDate)).TotalDays

Hope this may help you :slight_smile:

1 Like

@superanpunch and Manish

Both are not working displaying error. My code is

In Assign i have mentioned the above code
trying to store the result in a
String - Error is Disallows implicit conversion from double to String
Int - Disallows implicit conversion from double to integer

Any updates from anyone

@Robotics Since you haven’t tagged us properly didn’t get the notifications :sweat_smile: .

Can you send the Screenshot of how you have used the Expression in the Workflow?

@Robotics I think you want to store the value as String, So you can add .ToString at the end of Expression

Hi @Robotics

I have created one workflow for the same. It gives the difference of all 4 parameters.
Main.xaml (9.9 KB)

Workflow :-
image

Output :-
image

Mark as solution and like it :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.