Assign YourDateFormat = “dd-MM-yyyy”
(you can change it as per your date format present in excel.
To get the records which have 1 day left for expiry :
Expiry_OnedayDt = (From row In InputDt where (Datetime.ParseExact(row(“Exp_Date”).ToString,YourDateFormat,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”).Equals(Now.AddDays(1).ToString(“dd-MM-yyyy”))) Select row).CopyToDataTable()
To get the records which have 3 day left for expiry :
Expiry_ThreedayDt = (From row In InputDt where (Datetime.ParseExact(row(“Exp_Date”).ToString,YourDateFormat,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”).Equals(Now.AddDays(3).ToString(“dd-MM-yyyy”))) Select row).CopyToDataTable()
To get the records which have 7 day left for expiry :
Expiry_SevendayDt = (From row In InputDt where (Datetime.ParseExact(row(“Exp_Date”).ToString,YourDateFormat,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”).Equals(Now.AddDays(7).ToString(“dd-MM-yyyy”))) Select row).CopyToDataTable()
Thanks for your answer.
Actually, I already have a column that gives expiry days left for subscription, I have to loop through that column checking for which customers have 3, 5, and 7 days left. And then need to send SMS.
My IF condition is not working correctly as it should be.
days_to_expire = CurrentRow.Item(0).ToString
days_to_expire > = 1 AND days_to_expire <=3 ( for customers who have 3 days left).
Is this the right thing to do.?
Hi, Thank you for your response.
There is a new change as follows.
When the SMS is send where only three days are left to expiry ,
after that a second notification is to be send for renewal after 5 days of previous SMS send( which here is sent when 3 days were left to expiry). So if sms was sent on 1/jan/2007 as three days left to expiry the other SMS has to be sent on 7/jan/2007.