vb.net 将当前日期加一个月

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1382823/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 14:24:12  来源:igfitidea点击:

To add one month to current date

vb.netdatetime

提问by user42348

I have to add one month to todays date and have to get date after 1 month.Can anybody help?

我必须在今天的日期上加一个月,并且必须在 1 个月后获取日期。有人可以帮忙吗?

回答by Philip Fourie

Dim newDate as DateTime = DateTime.Now.AddMonths(1)

回答by Marcin Deptu?a

dateAfterMonth = dateAfterMonth.AddMonths(1)
If you would add 1 month from now:
dateAfterMonth = DateTime.Now.AddMonths(1)

dateAfterMonth = dateAfterMonth.AddMonths(1)
如果您从现在开始添加 1 个月:
dateAfterMonth = DateTime.Now.AddMonths(1)

回答by Simon

using Fluent DateTime http://fluentdatetime.codeplex.com/

使用 Fluent DateTime http://fluentdatetime.codeplex.com/

       Dim newDate as DateTime = 1.Months().FromNow()