I want to set a DateTime property to previous day at 00:00:00. I don\'t know why DateTime.AddDays(-1) isn\'t working. Or why DateTime.AddTicks(-1) isn\'t working. First sho
the easiest way is this..
DateTime yesterday = DateTime.Now.Date.AddDays(-1);
now if you are trying to use a variable that has already been created, you would do this...
DateTime yesterday = DateTime.Now; // will give you today's date
yesterday = yesterday.Date.AddDays(-1); // will give you yesterday's date at 12:00 AM
Possibly posting your code will show us what you are doing wrong.