我正在尝试根据系统的日期和时间获取到期日期。获得截止日期是直截了当的,但是改变标签是行不通的。我得到的结果通常是今天的日期。
Public Function FindDueDate()
Dim Due As Date = Now
If DayOfWeek.Monday Then
DueDate.Text = Due.AddDays(14).ToString
ElseIf DayOfWeek.Tuesday Then
DueDate.Text = Due.AddDays(13).ToString
ElseIf DayOfWeek.Wednesday And Hour(Now) < 16 Then
DueDate.Text = Due.AddDays(12).ToString
ElseIf DayOfWeek.Wednesday And Hour(Now) >= 16 Then
DueDate.Text = Due.AddDays(19).ToString
ElseIf DayOfWeek.Thursday Then
DueDate.Text = Due.AddDays(18).ToString
ElseIf DayOfWeek.Friday Then
DueDate.Text = Due.AddDays(17).ToString
ElseIf DayOfWeek.Saturday Then
DueDate.Text = Due.AddDays(16).ToString
ElseIf DayOfWeek.Sunday Then
DueDate.Text = Due.AddDays(15).ToString
End If
End Function
我做错了什么?
答案 0 :(得分:0)
我认为你要做的是:
Public Function FindDueDate()
Dim Due As Date = Now
If Due.DayOfWeek = DayOfWeek.Monday Then
DueDate.Text = Due.AddDays(14).ToString
ElseIf Due.DayOfWeek = DayOfWeek.Tuesday Then
...
End If
End Function