# Comparison of Dates

Hi I have three variables with a Date as value as shown below. I need to make a decision rule to pick the correct value for variable “Correct Date”

Scenario 1:

PI = 13/07/2021

Min EX = 15/07/2021

Max EX = 20/07/2021

If PI is before Min Ex, i.e, (PI < Min EX):
“Correct Date” = Min EX(15/07/2021)

Scenario 2:
PI = 18/07/2021

Min EX = 15/07/2021

Max EX = 20/07/2021

If PI within range Min EX and Max EX, i.e, (Min EX < PI < Max EX):
“Correct Date” = PI(18/07/2021)

P.S. The value of PI, Min EX, Max EX will change accordingly. But the decision rules should stand.

Thanks!

Hi,

Regards,

Hi Yudhisteer,

To get the difference between Two date(one with recent)
DateDiff(DateInterval.Day,Convert.ToDateTime(dat),Convert.ToDateTime(date_1))
date_1 is the recent one

The output will be a single integer
Try finding the difference between PI, Min Ex, Max Ex by current date and then implement your scenarios

Hope it works

Regards,
Shaf

Hi ,

But my date time format should not change.We can preprocess it after but the original one should remain as typed above.

Hi,

Alright. Can you try the following sample?

Sequence.xaml (9.0 KB)

Regards,

1 Like

Thanks a lot!!
It works

1 Like

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