If in a C# Program we want to generate FirstDate and LastDate of a month, and we already have month and year, the following code can be used:
int vMonth = 12;
DateTime vFirstDateOfMonth = new DateTime(2017, vMonth, 1);
DateTime vLastDateOfMonth = vFirstDateOfMonth.AddMonths(1).AddDays(-1);
Happy Coding!!!
Comments