Date Manipulation - to check either varDate is less than 15 days from Now

Hi Guyz,
Please help me to resolve this, I have to check either the varDate is less than 15 days or not from today’s date.
And the vardate format is “dd/MM/yy” i.e 02/12/23.

Please help. Thanks.



Assign As DateTime Formate Variable : DateTime.ParseExact(varDate, "dd/MM/yy", System.Globalization.CultureInfo.InvariantCulture) < DateTime.Now.AddDays(15)


DateTime.ParseExact(str, “dd/MM/yyyy”, System.Globalization.CultureInfo.InvariantCulture) < DateTime.Now.AddDays(-15)

please check the below attached image,have done in both cases(true & false)


Hello @Anjali_Rani

  1. Assign varDate = “02/12/23” ’ Replace with your actual date

  2. Assign dateToday = DateTime.Now.ToString(“dd/MM/yy”)

  3. Assign dateFormat = “dd/MM/yy”

  4. Assign daysDifference = (DateTime.ParseExact(dateToday, dateFormat, CultureInfo.InvariantCulture) - DateTime.ParseExact(varDate, dateFormat, CultureInfo.InvariantCulture)).Days

  5. If daysDifference < 15

  6. LogMessage("varDate is less than 15 days from today.")
  7. Else

  8. LogMessage("varDate is NOT less than 15 days from today.")

Thanks & Cheers!!!

Hi @Anjali_Rani

Assuming varDate is your date string variable

parsedDate As DateTime = DateTime.ParseExact(varDate, “dd/MM/yy”, System.Globalization.CultureInfo.InvariantCulture)

fifteenDaysAgo As DateTime = DateTime.Today.AddDays(-15)

If parsedDate > fifteenDaysAgo Then
’ varDate is less than 15 days old.
’ varDate is not less than 15 days old.
End If