开发者

how to calculate the 4 days before date of the target date

开发者 https://www.devze.com 2022-12-27 09:57 出处:网络
i have two dates ValidFrom : 20-04-2010 validTo: 02-05-2010 i need to know 4 d开发者_JAVA百科ays(date) before the validity expire .how to calculate the 4 days before date of the validity expiredate

i have two dates

ValidFrom : 20-04-2010

validTo : 02-05-2010

i need to know 4 d开发者_JAVA百科ays(date) before the validity expire .how to calculate the 4 days before date of the validity expire date 02-05-2010


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

If that's not what you mean, you're going to have to be much more specific.


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

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

精彩评论

暂无评论...
验证码 换一张
取 消