I have the following code in my C# program.
DateTime dateForButton = DateTime.Now; dateForButton = dateForButton.AddDays(-1); // ERROR: un-representable Date
You can do:
DateTime.Today.AddDays(-1)