Problems with Datediff

I am having trouble with the Datediff. Knipsel
As you can see the Datediff must give me a difference from 2 days. How is it possible that it’s giving me a difference from 59. The dates where I need the difference from you can see in the image ass well.

Hi
I would say it’s reading it as mm-dd-yyyy and not dd-mm-yyyy.

You are right. How can i change that?

@438654 There is a custom activity for date comparsion you can use this

That activity gives you the most recent date not the difference in amount of days

@438654 Is it possible to share your workflow.

There are a number of ways but obviously, you need to swap the day and month. Extract the day and month separately (ie use substring to grab 04 as the month and 01 as the day) then try creating new date variables and assign them as new Date(Year(d),mth,day)) where d is the date you need to transform. Then perform DateDiff with the 2 new dates. Hope that helps.

hmm think thats to complex. For me it’s better to fix it in Excel. The dates that I want to compare are Startdate from Excel and System Date Now. So for me it’s better to transform de column in Excel

Hi,
You can convert your date format using the below expression.
DateTime.ParseExact(“01-04-2018”, “dd-MM-yyyy”, CultureInfo.InvariantCulture).ToString(“MM-dd-yyyy”, CultureInfo.InvariantCulture).ToString
Also, Don’t forget to Import System.Globalization in Imports.
Later, you can run the datediff to get the desired Output.

2 Likes