vba - 如何比较文本框中的两个日期?
问题描述
我想比较文本框中的两个日期。
Public Function CourseStatus(ByVal RefDate2 As Variant) As String
Dim Description As String
If Len(RefDate2) > 0 And IsDate(RefDate2) Then
Select Case DateDiff("d", Date, RefDate2)
Case Is > 60
CourseStatus = "In Date"
Case Is > 0
CourseStatus = "Expiring"
Case Is = [ParticipationDate]
CourseStatus = "Not Refreshed"
Case Else
CourseStatus = "Expired"
End Select
Else
CourseStatus = "Please Book"
End If
End Function
如果[ParticipationDate]
&[RefDate2]
匹配返回“未刷新”作为 CourseStatus。
我需要在运行其余代码之前执行此操作,以提供“日期”“过期”“过期”,如果这些都不适用,则显示“请预订”。
例如
ParticipationDate 1/1/19
RefDate2 1/1/19
CourseStatus “未刷新”
解决方案
你可能会使用这样的东西:
If Len(RefDate2) > 0 And IsDate(RefDate2) Then
Select Case DateDiff("d", Date, RefDate2)
Case Is > 60
CourseStatus = "In Date"
Case Is > 0
CourseStatus = "Expiring"
Case Else
If DateDiff("d", RefDate2, [ParticipationDate]) = 0 Then
CourseStatus = "Not Refreshed"
Else
CourseStatus = "Expired"
End If
End Select
Else
CourseStatus = "Please Book"
End If
推荐阅读
- c++ - 在具有分数增量的 for 循环中使用“双”数据类型的问题
- r - 如何使用 lavaan 获得交叉载荷?
- c++ - 如何索引双重限制的整数分区?
- python - 通过网络爬虫从句子中提取相关信息?
- xamarin - xamarin 形式的圆形进度条
- windows - nssm - 不安装应用程序路径及其参数
- eclipse -
我正在尝试读取插入到我的项目中的一些图像,但我做不到。我创建了一个 maven Dynamic Web Module 3.0 项目,并在 Web 内容中插入了资源/图像文件夹。我在构建路径中添加了该文件夹,因为我认为它无法访问但它不起作用。
我尝试了不同的代码模式:
<p:graphicImage value=
- javascript - JavaScript .reduce() 方法无法正常工作
- python - 获取python文件输出并将输出读入excel
- angular5 - 显示表格中输入的值