如何获取上个月的总计数
我想获取上个月的总天数
代码
Dim period as string
period = '01/2011'
totdays = DateDiff("d", txtPeriod, DateAdd("m", 1, txtPeriod))
'这将给出该月的总天数...
但我想获取上个月的总天数
用户将仅输入当前月份,但代码应验证上个月的
预期输出
If period = '02/2011' means then it should display 31 days 'January
If period = '03/2011' means then it should display 28 days 'February
如何这样做...
任何帮助
I want to get the previous month total day count
Code
Dim period as string
period = '01/2011'
totdays = DateDiff("d", txtPeriod, DateAdd("m", 1, txtPeriod))
'this will give the totaldays of the month...
But i want to get total days of the previous month
User will type current month only, but code should validate previous month
Expected Output
If period = '02/2011' means then it should display 31 days 'January
If period = '03/2011' means then it should display 28 days 'February
How to do this...
Any Help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对我来说效果很好。另外,为什么你有一个变量
period
,但在计算中使用txtPeriod
?This worked fine for me. Also, why do you have a variable
period
, but usetxtPeriod
in your calculations?