How to calculate 4 days before the date of a given date

I have two dates

ValidFrom: 20-04-2010

validTo: 02-05-2010

I need to know 4 days (date) before expiration. How to calculate 4 days before expiration date 02-05-2010

+2


a source to share


2 answers


var dt = new DateTime(2010, 5, 2);
var fourDaysBefore = dt.AddDays(-4);

      



If that's not what you mean, you need to be more specific.

+14


a source


I can't tell what the context of the question is, but this is one way to do it if you are trying to do it in mysql.



SELECT ADDDATE('2010-05-02', INTERVAL -4 DAY);

      

+1


a source







All Articles