Calculate date difference, DateDiff not working. Expression is not an array or method, and cannot have an argument list


I need to compare 2 dates and find the difference in the number of days between the 2 dates. I have tried using DateDiff from the various Forum solutions I found, but I cannot get it to work. Can anyone help me to figure out what is the issue?

Thank you very much!

datedifference = DateDiff(DateInterval.Day,Convert.ToDateTime(date1),Convert.ToDateTime(date2))

statement looks good, so far:

give try on

  • doing the same on a new assign activity
  • go to assign left side: ctrl+A,ctrl+X,Enter,ctrl+V,Tab

Sometimes compiler cache hangs and is not accepting correct statements

what is the variable type date 1 and date 2
I think it is string if string please Change the variable type and the type is System.datetime
Because dateDiff needs date variable

Chethan P

Use this inside the assign and it shuld be in the date variabeltype


I re-did the assign and it is working now. Thank you for the suggestion!

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