
int todaysDate = DateTime.Now.Day;
// This will retuns start date of the month
DateTime payDate=new DateTime(DateTime.Now.Year,DateTime.Now.Month,1);
if (todaysDate > 21)
{
payDate = payDate.AddMonths(1).AddDays(24); //25 of the next month
}
else
{
payDate = payDate.AddDays(24); //25 of the this month
}
The above solution is for the loner applies on 21st or before 21st of the month then it will return pay Date = 25th of the current month
If you are looking for the solution is for the loner applies on 21st or after21st of the month then
int todaysDate = DateTime.Now.Day;
// This will retuns start date of the month
DateTime payDate=new DateTime(DateTime.Now.Year,DateTime.Now.Month,1);
if (todaysDate >= 21)
{
payDate = payDate.AddMonths(1).AddDays(24); //25 of the next month
}
else
{
payDate = payDate.AddDays(24); //25 of the this month
}
Please Mark as answer if this solution is helpful for you
Thanks & Rgards,
Dhiren Kumar Kaunar