如何在我的约会日期添加不同的月份 [英] How to add different month to my date
问题描述
我有一个健身房应用程序,如果你购买3个月,我有一个购买要约金额将是200美元(例子)我想要的是如何在3个月结束前提醒用户我有一个列在我的有开始日期的桌子我想在结束日期前10天提醒他
我有一个说明我要改变的报价将是1个月,5个月无论什么,,,,
我尝试过的事情:
i have a Gym application and i have a offer for buy if you buy 3 month the amount will be 200 $ (example) what i looking for is how to remind the user before the 3 months end i have a column in my table with the start date i want to remind him 10 days before the end date
and i have a note that the offer my be changing like it will be 1 month , 5 month whatever ,,,,
What I have tried:
DateTime nextMonth = date.AddDays(1).AddMonths(1).AddDays(-1);
回合它没有帮助我
i希望用文本框更改AddMonths(1)我的数字是(报价)。
bout it didn't help me
i want to change the AddMonths(1) with a textbox have the number for me it is the (offer).
推荐答案
(示例)我想要的是如何在3个月结束前提醒用户我有一个列在我的桌子上有开始日期我想在结束日期前10天提醒他
和ih请注意,我要改变的报价将是1个月,5个月无论如何,,,,
我尝试过:
(example) what i looking for is how to remind the user before the 3 months end i have a column in my table with the start date i want to remind him 10 days before the end date
and i have a note that the offer my be changing like it will be 1 month , 5 month whatever ,,,,
What I have tried:
DateTime nextMonth = date.AddDays(1).AddMonths(1).AddDays(-1);
回合它没有不帮我
i希望用文本框更改AddMonths(1)有我的号码是(商品)。
bout it didn't help me
i want to change the AddMonths(1) with a textbox have the number for me it is the (offer).
取日期最后续订并添加下一次续订的月数(1,3,5等)。从这几天减去10。将其与今天的日期进行比较,看看是否应该发送提醒。
Take the date of last renewal and add the number of months to the next renewal (1, 3, 5 etc.). Subtract 10 from the days. Compare that to today's date to see whether the reminder should be sent.
您应该使用 numericUpDown控件 [ ^ ](我在这里假设WinForms但在ASP.NET中有等价物, WPF)
但是现在..(未经测试)
Instead of a TextBox you should really use a numericUpDown control[^] (I'm assuming WinForms here but there are equivalents in ASP.NET and WPF)
But for now .. (untested)
int i;
DateTime nextMonth;
if(int.TryParse(txtBox.Text, out i)
{
nextMonth = date.AddDays(1).AddMonths(i).AddDays(-1);
}
这篇关于如何在我的约会日期添加不同的月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!