I have the following code in my C # program.
DateTime dateForButton = DateTime.Now; dateForButton = dateForButton.AddDays(-1);
Whenever I run it, I get the following error:
An added or subtracted value results in an unrepresentable DateTime.
Parameter Name: Value
I have never seen this error message before, and I donโt understand why I see it. From the answers that I read so far, I believe that I can use -1 in the addition operation to subtract days, but as my question shows, this is not the case when I try to do it.
c # datetime
Buena Jun 22 '12 at 7:33 2012-06-22 07:33
source share