# how to handle date formats [Resolved]

Posted by Jerome under VB.NET on 4/16/2012 | Points: 10 | Views : 1080 | Status : [Member] | Replies : 1
I have a loan system.The pay day is every 25 of the month and its cu off is every 21 of the month.When the loaner applies before 21 of the month he/she will have the first pay date on the 25 of the month and its pay end date will depend on his term(1yr. or 2yrs.) and if he/she will apply after 21 of the month he/she will have its first pay date on the 25 of the next month.Kindly show a solution to my problem.Thanks!

#### Responses

Posted by: dhirenkaunar-15094 on: 4/17/2012 [Member] Starter | Points: 50
 0 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 youThanks & Rgards, Dhiren Kumar KaunarJerome, if this helps please login to Mark As Answer. | Alert Moderator
Latest Posts