Dim d As Date = Date.today
Dim t As Date = Date.now
Dim FirstDay As Date = New Date(d.year, d.month,1) '第一天
Dim LastDay As Date = New Date(d.year, d.month,Date.DaysInMonth(d.year, d.month)) '最后一天
Dim y As Integer = Date.Today.Year
Dim q As Integer = (Date.Today.Month - 1) \ 3 + 1 '计算现在是第几个季度
Dim dt1 As New Date(y, 3 * (q - 1) + 1, 1) '获取本季度的第一天
Dim dt2 As New Date(y, 3 * q, Date.DaysInMonth(y,3 * q)) '获取本季度的最后一天
output.Show(dt2)
Dim w As Integer = Date.Today.DayOfWeek '算出今天是星期几
Dim w1 As Date = Date.Today.AddDays(-w) '获取本周的第一天
Dim w2 As Date = Date.Today.AddDays(6 - w) '获取本周的最后一天
For Each dr As DataRow In DataTables("内部函数表").DataRows
If dr("计划")=True Then
If dr("周期")="每月第一天" Then
If Date.today=FirstDay And t.Hour="17" Then
MessageBox.Show("1")
End If
Else If dr("周期")="每月最后一天" Then
If Date.today=LastDay And t.Hour="14" Then
MessageBox.Show("33")
End If
Else If dr("周期")="本季度" Then
If Date.today=dt2 And t.Hour="17" Then
MessageBox.Show("333")
End If
Else If dr("周期")="每周一" Then
If w=1 And t.Hour="17" Then
MessageBox.Show("周一")
End If
Else If dr("周期")="每周二" Then
If w=2 And t.Hour="17"Then
MessageBox.Show("周二")
End If
Else If dr("周期")="每周三" Then
If w=3 And t.Hour="14"Then
MessageBox.Show("周三")
End If
Else If dr("周期")="每周四" Then
If w=4 And t.Hour="17"Then
MessageBox.Show("周四")
End If
Else If dr("周期")="每周五" Then
If w=5 And t.Hour="17"Then
MessageBox.Show("周五")
End If
Else If dr("周期")="每周六" Then
If w=6 And t.Hour="17"Then
MessageBox.Show("周六")
End If
Else If dr("周期")="每周日" Then
If w=0 And t.Hour="14"Then
MessageBox.Show("周日")
End If
End If
End If
Next
3、可根据需要再另外新建一个计划管理窗体,主要用于计划、周期字段值的更改
上述操作后初步可以实现计划字段是true时候,满足条件时弹出对应的提示内容。