减去DateTime对象1天

问题描述:

我想从我的约会基材的一天,所以,当我的日期为 30-7-2013 比我想的 29-7-2013

I want to substrate one day from my date, so that when my date is 30-7-2013 than I want 29-7-2013

只需使用的 AddDays 方法,记住,它不会改变的价值,它被称为 - 它的返回的一个新的的DateTime

Just use the AddDays method, remembering that it doesn't change the value it's called on - it returns a new DateTime value.

DateTime date = ...;
date = date.AddDays(-1);