DateAdd提供了错误的答案 [英] DateAdd gives a wrong anser
问题描述
亲爱的所有人,
我正在使用以下代码来获取当前日期,并向该日期添加一个月并打印相同的日期.
代码:
Dim nxt as Date
nxt =现在
Msbox(今天的日期:"和nxt.Date)
MsgBox(下一个到期日期:"&DateAdd(DateInterval.Month,1,nxt.Date))
但是,在执行代码时,我得到以下响应:
今天的日期:2011年12月25日
下一个到期日:12:00:00 AM
请帮我.
谢谢和问候,
-
Sridhar K
Dear All,
I am using the following code to get the current date and add one month to that date and print the same.
Code:
Dim nxt as Date
nxt = Now
Msbox ("Today''s Date: " & nxt.Date)
MsgBox("Next Due Date: " & DateAdd(DateInterval.Month, 1, nxt.Date))
However, on execution of the code, i get the following response:
Today''s Date: 12/25/2011
Next Due Date: 12:00:00 AM
Pl help me.
Thanks and regards,
--
Sridhar K
推荐答案
尝试一下
Try this
MsgBox("Next Due Date: " & DateAdd(DateInterval.Month, 1, nxt))
代替
Instead of
MsgBox("Next Due Date: " & DateAdd(DateInterval.Month, 1, nxt.Date))
希望这会有所帮助.
Hope this helps.
这篇关于DateAdd提供了错误的答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!