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.
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