DateDiff always returns 0

Hi. I’m a Community Edition user and I’m trying to calculate the interval between two DateTime (note: the interval is greater than 366 days), I’ve done the following:

  1. Assign variable StartDate_DateTime (type DateTime) to DateTime.ParseExact(Start_Date, “dd-MMM-yyyy”, CultureInfo.InvariantCulture) ==> Output is in “MM/dd/yyyy hh:mm:ss”. Same process repeated for EndDate_DateTime
  2. Assign variable TENURE (type Int64) to DateAndTime.DateDiff(DateInterval.Day; StartDate_DateTime, EndDate_DateTime) ==> Output is 0

I’ve also tried using cdate function on the StartDate_DateTime and EndDate_DateTime but it still returns 0.

Thank you.

@Alex_Tee - Can you please as below

DateDiff(dateinterval.Day,Convert.todatetime(Start_Date),Convert.todatetime(End_Date))

Sample Input and Output

image

1 Like

It’s working now. Thank you very much.

1 Like

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