问题
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