在给定的日子里添加30天 [英] Add 30 days to a given days

查看:65
本文介绍了在给定的日子里添加30天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

M做一个批准系统来显示日期即。在给定(现在/今天)日期之后30天。

好​​吧它实际上就像这样。每当我登录系统今天的日期将出现,在预期日期文本框中,日期自动为shd自动显示已经显示的当前日期增加30天。

例如。我在2015年11月4日登录(dd / mmmm / yyyy),它会自动显示04/12月/ 2015.

我已经完成了代码。但在预期的文本框中显示今天的日期。任何人都会帮忙。



tq。

我的代码:



expected_Date.Text = Now.ToString(dd MMMM yyyy"))

'写下今天的价值。

Console.WriteLine(;今天:{0},DateTime.Today)

'加30天。

Dim tdate As DateTime = DateTime.Today.AddDays(30)

写tdate值。

Console.WriteLine(tdate:{0},tdate)

解决方案

从这里: https://msdn.microsoft.com/en-us/library/system.datetime.adddays(v = vs.110 ).aspx?cs-save-lang = 1& cs-lang = vb#code-snippet-2 [ ^ ]



 昏暗今天 System.DateTime 
Dim answer As System.DateTime

今天= System.DateTime.Now
answer = today.AddDays( 30


你还没有设置新日期的文本框文本,请按以下步骤操作



 Console.WriteLine(tdate:{ 0 },tdate)
expected_Date.Text = tdate.ToString(dd MMMM yyyy


Hi, M doing a approval system to display the date ie. 30 days later after a given (present/todays)date.
Well its actually like this.whenever i login into the system todays date will appear, in the expected date text box, the date shd be automatically displayed adding 30 days to the present date which is already displayed.
Eg. supose i login on 04/november/2015(dd/mmmm/yyyy), it shud automatically display 04/december/2015.
im already did the code. but in expected text box shows todays date. anyone pls help.

tq.
its my code:

expected_Date.Text = Now.ToString(dd MMMM yyyy"))
'Write the today value.
Console.WriteLine(;Today: {0}, DateTime.Today)
'add thirty days.
Dim tdate As DateTime = DateTime.Today.AddDays(30)
Write the tdate value.
Console.WriteLine(tdate: {0}, tdate)

解决方案

From here: https://msdn.microsoft.com/en-us/library/system.datetime.adddays(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2[^]

Dim today As System.DateTime
Dim answer As System.DateTime

today = System.DateTime.Now
answer = today.AddDays(30)


you haven't set the textbox text from the new date, do as below

Console.WriteLine(tdate: {0}, tdate)
expected_Date.Text = tdate.ToString(dd MMMM yyyy")


这篇关于在给定的日子里添加30天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆