I am using ASP.NET, C# 2.0.
I am having a date issue. The error is "Year, Month and Day parameters describe an un-representable Datetime"
I am adding the date with 14 and 7 depending on a condition.
Below is the code I have used:
DateTime d = DateTime.Now;
int addDays =0;
if (Convert.ToString(Session["School"]) == "US" )
addDays = 14;
addDays = 7;
DateTime n = new DateTime(d.Year, d.Month, d.Day + addDays);
The issue happens, if the date is 17 for US Schools and 25 for other schools, if the month has 30 days. This issue will happen for 28 days in February, and 30,31 days for other months.
How to add this 14 and 7 depending on the months. I know i have to increment the month by 1 and increase the date to the next month( and increase year to next, if done in december). But not sure, how to do this.
How to add this?
View Complete Post