Hi ,
I have two dates to compare .
str_sign_date
str_P3_oppty_date
I need to check a condition if str_P3_oppty_date is 15 days prior to or within 15 days of str_sign_date
what will be the conditions I need to implement?
Hi ,
I have two dates to compare .
str_sign_date
str_P3_oppty_date
I need to check a condition if str_P3_oppty_date is 15 days prior to or within 15 days of str_sign_date
what will be the conditions I need to implement?
Take the datediff and check math.abs >15
If you want to know which is beofre or which si after if second date is greater you get positive number if first si greater you get negative number
Cheers
Try this approach
Assuming str_sign_date and str_P3_oppty_date are provided as string inputs
DateTime Date1= DateTime.ParseExact(str_sign_date, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture)
DateTime Date2 = DateTime.ParseExact(str_P3_oppty_date, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture)
if (Date2 >= Date1.AddDays(-15) && Date2 <= Date1.AddDays(15))
{
// Dates are within the specified range.
}
else
{
// Dates are not within the specified range.
}
here my requirement is to check whether
str_P3_oppty_date falls before 15 days of str_sign_date or within fifteen days of str_sign_date
For example:
str_P3_oppty_date is 02-10-2025 and my str_sign_date is 01-26-2025. Then I need to check if , str_P3_oppty_date is prior to or within 15 days of the str_sign_date
Hi @dutta.marina ,
signDate As DateTime = DateTime.ParseExact(str_sign_date, "MM-dd-yyyy", System.Globalization.CultureInfo.InvariantCulture)
opptyDate As DateTime = DateTime.ParseExact(str_P3_oppty_date, "MM-dd-yyyy", System.Globalization.CultureInfo.InvariantCulture)
If opptyDate >= signDate.AddDays(-15) AndAlso opptyDate <= signDate.AddDays(15) Then
' Condition is met, proceed with your logic
End If
Regards,
Vinit Mhatre
Convert them to date format
dt_P3_oppty_date = DateTime.ParseExact(str_P3_oppty_date, "MM-dd-yyyy", System.Globalization.CultureInfo.InvariantCulture)
dt_sign_date = DateTime.ParseExact(str_sign_date, "MM-dd-yyyy", System.Globalization.CultureInfo.InvariantCulture)
And in if Activity condition use the expression
dt_P3_oppty_date <= dt_sign_date.AddDays(15) And dt_P3_oppty_date >= dt_sign_date.AddDays(-15)
Hope this helps!
Try this logic:
str_P3_oppty_date < str_sign_date.AddDays(-15) Or str_P3_oppty_date > str_sign_date.AddDays(15)
βAndβ logic does not make sense, as a date cannot be both greater than And smaller than another date.
If you are including the 15th day. Just include an β=β sign both sides making it β<=β and β>=β
Do include the code for proper formating of the date as mentioned in previous replies.
Thank you.
Happy Automation
This is correct expression but I think instead of AND it should be OR in the expression?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.