Getting issue while Substracting extracted dates

Hi Community,

I am facing a problem in subtracting the date by the steps below:

  1. test_expdate = DateTime.ParseExact(test_expdate,“dd/MM/yy”,System.Globalization.DateTimeFormatInfo.InvariantInfo).ToString(“MM/dd/yyyy”)
  2. test_tddate = now.date.ToString(“MM/dd/yyyy”)
  3. final_date = Date.Parse(test_expdate).Subtract(Date.Parse(test_tddate)).ToString

But the no of days is not coming in integer which is shown in the below screen shot. Need help!


Thanks in advance

Hi @madhavraichur25

Try this

test_expdate="01/03/2024"
Diff=(Now.Date - DateTime.ParseExact(test_expdate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture)).Days

Cheers!!

Hi @madhavraichur25

Welcome to the community! :blush:

This can be achieved using an assign instead of three with following steps:

  1. create a variable named No_Of_days as Int64 by selecting browse for types.
  2. In the value use this expression DateDiff(DateInterval.Day,CDate(now.ToString(“MM/dd/yyyy”)),Cdate(DateTime.ParseExact(your_date_String_Var.Trim,“dd/MM/yy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)))

Cheers! :wink:
Biswajeet Kumar

2 Likes

Thankyou @Biswajeet_kumar now bot is working fine :innocent: :innocent:

1 Like

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