Date comparison within one year only considering todays date

Hello team,

I need the logic to compare the input date is falling under one year considering the todays date.

Example: Input is 06th jan 2024
i need to compare the above input with todays date-365 i.e; 7th march 2024 to 8th march 2023.
if the date falls under the one year range, the system should accept otherwise the system should through throw error considering the todays date.

Thank you.

Hi @satyarohith2020

Try this:

Assign-> inputDateString = "06 Jan 2024"

If 
   DateTime.ParseExact(inputDateString, "dd MMM yyyy", System.Globalization.CultureInfo.InvariantCulture) >= DateTime.Now.AddDays(-365) AndAlso DateTime.ParseExact(inputDateString, "dd MMM yyyy", System.Globalization.CultureInfo.InvariantCulture) <= DateTime.Now 
Then
    // Date falls within one year range
    // Accept the date
Else
    // Date does not fall within one year range
    // Throw an error or handle accordingly
End If

Hope it helps

@satyarohith2020,

Welcome back!

Here is a possible solution.

Throw Exception:

Thanks,
Ashok :slight_smile:

Hi @satyarohith2020

Check the below workflow for better understanding



Sequence42.xaml (8.3 KB)

Hope it helps!!