Thanks:  0
Likes:  0
Dislikes:  0

# Thread: Checking wherther given date is between two dates.

1. ## Checking wherther given date is between two dates.

Hello All,,

I have a situation here.. where in,.. i have a date and i need to verify/check wherther, this date falls between 2 given other dates.

Ex. I have a date as 10-feb-2007. And i need to check wherther this date is in between two other dates like.. 01-jan-2007 and 15-mar-2007.

Thank you in advance for ur help.

Regards,
Bablu

2. ## Re: Checking wherther given date is between two da

Well Please try this way. Hope this might help

Date1 = DateDiff("d","01-jan-2007","10-feb-2007")
Date2 = DateDiff("d","15-mar-2007","10-feb-2007")

if date1&gt;0 and date2&lt;0 then
msgbox "Date lies between"
else
msgbox "Date does not lie in between other two dates"
End If

I am not sure if there is any other function that will automatically do this

3. ## Re: Checking wherther given date is between two da

Thanks a bunch Ankush.
Will try it and let you know.

Thanks again.

Regards,
Bablu

4. ## Re: Checking wherther given date is between two da

Post the exact code if you solve the problem

5. ## Re: Checking wherther given date is between two da

Convert all 3 values to Dates, then do a simple compare

ie. newDate = CDate(...)
lowerDate = CDate(...)
upperDate = CDate (...)

If newDate &gt; lowerDate And newDate &lt; upperDate Then

......

end if

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.