如何检查日期是否在两个给定日期之间 [英] How to check if a date is between two given date

查看:35
本文介绍了如何检查日期是否在两个给定日期之间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查日期是否在 vb Like 中的两个给定日期之间:

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

推荐答案

您需要在 T1 和 T2 之间进行比较.像这样的事情应该有效.请记住,年份必须相同,否则比较将不起作用,如果您不希望删除等号,则此比较也包括端点,这也是假设您使用的是日期对象

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

这篇关于如何检查日期是否在两个给定日期之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆