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.
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)
Cheers!!
Hello @Anjali_Rani
Assign varDate = “02/12/23” ’ Replace with your actual date
Assign dateToday = DateTime.Now.ToString(“dd/MM/yy”)
Assign dateFormat = “dd/MM/yy”
Assign daysDifference = (DateTime.ParseExact(dateToday, dateFormat, CultureInfo.InvariantCulture) - DateTime.ParseExact(varDate, dateFormat, CultureInfo.InvariantCulture)).Days
If daysDifference < 15
Then
LogMessage("varDate is less than 15 days from today.")
Else
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.
Else
’ varDate is not less than 15 days old.
End If