How to check if a date is between two given date

為{幸葍}努か 提交于 2020-01-06 04:24:05

问题


how to check if a date is between two given date in vb Like :

If ( BirthDate Between T1 and T2)  Then
    Label5.Caption = " Your Horoscope Sign is LIBRA"
End If

回答1:


You will need to compare it between both T1 and T2. Something like this should work. Keep in mind the years will have to be the same or the comparison will not work, also this comparison includes the endpoints if you do not wish that remove the equals sign, this is also supposing that you are using date objects

If (BirthDate >= T1 And BirthDate <= T2) Then
    Label5.Caption = "You're In"
Else
    Label5.Caption = "You're Out"
End If


来源:https://stackoverflow.com/questions/22364994/how-to-check-if-a-date-is-between-two-given-date

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!