Verify the Difference between two dates

Hi,

I am fetching 2 dates from web application and storing it in a variable.

  1. “NOC Valid From” date is stored in “validFrom” variable.
  2. “NOC Valid to” date is stored in “validTo” variable.
  3. validFrom value = 13-Oct-2022
  4. validTo value = 12-Oct-2023

Validation

  1. I want to verify difference between above 2 dates is 1 year.

please help

HI @shruthi_arali

Try with this expression

DateDifference = DateDiff(DateInterval.Day, Convert.todatetime(“13-Oct-2022”), Convert.todatetime(“12-Oct-2023”))

Check out this blog

Regards
Gokul

1 Like

Output @shruthi_arali

image

what should be the variable type of DateDifference.

Hello @shruthi_arali

If you want to directly use the activity instead of LINQ, then you can try the Modify Date activity.

Thanks

It should be - DateDifference variable to Int64 @shruthi_arali

Regards
Gokul

@Gokul001

Getting below error when i used variable as int32 for dateDiff

You variable type Int64 @shruthi_arali

Click on the Browser Types

image

Search for Int64

@Gokul001

I have used type int64

  1. NOCvalidFrom - String - value 12-Oct-2022
  2. NOCvalidTo - String - value 13-Oct-2022
  3. dateDiff -int64
    formula :–> dateDiff = DateDiff(DateInterval.Day, Convert.todatetime(NOCvalidFrom), Convert.todatetime(NOCvalidTo))

Check out this XAML file @shruthi_arali

Main.xaml (6.6 KB)

3 Likes

thank you @Gokul001 … Its working fine…

1 Like

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