Year, Month, and Day parameters describe an un-representable DateTime Exception

The DateTime constructor you are calling accepts parameters in the order year, month, day.

You are providing them in the order month, day, year -- which ends up trying to assign meaningless values. The documentation is pretty clear on what the allowed values are and what happens if you pass 2012 for the "day" value.


I just ran into this and my issue was I was creating a date in February. I tried to do the following...

new Date(2013, 2, 30)

Since there is not a February 30th, the date failed to create. When I changed to

new Date(2013, 2, 28)

it worked fine.


if the InsertDate meant to be the date / time of creation you can just use the following

DateTime InsertDate  = DateTime.Now;