从今天开始扣除工作日 [英] Deducting weekdays from todays date
本文介绍了从今天开始扣除工作日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好b $ b
我想从今天的日期开始扣除5个工作日。
根据所有搜索我已完成此代码应该工作:
Hi
I am trying to deduct 5 working days from todays date.
According to all the searches I have done this code should work:
Dim DaysToDeduct As Integer = 5
Dim theDate As Date = Date.Today
MsgBox(theDate)
While DaysToDeduct > 0
If theDate.DayOfWeek <> DayOfWeek.Saturday And theDate.DayOfWeek <> DayOfWeek.Sunday Then
theDate.AddDays(-1)
DaysToDeduct = DaysToDeduct - 1
End If
End While
MsgBox(theDate)
但它没有......
2个Msgbox的显示日期相同。
你能帮忙。
but it doesn't......
The 2 Msgbox's show the same date.
Could you please help.
推荐答案
这样做
Do this
theDate = theDate.AddDays(-1)
这篇关于从今天开始扣除工作日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文