0

Hi everybody,

I'm wondering is there a way to check wither a dateTime is selected within particular period.

Let me give a e.g:

suppose I've
date1 = "07/18/2010 08:00"
date2 = "07/18/2010 10:30"

date1 and date2 represent a period of time from 8 to 10 in 18/07.

I want to check that the new entered period date3 and date4 are not intersecting the period above.

e.g.
date3 = "07/18/2010 07:00"
date4 = "07/18/2010 011:00"

I'm working on asp.net VB.NET

Could PLZ hint me how to solve it?

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by rohand
0

If you are going to check this at the time of inserting row in database then you can check it by firing SQL query and see if it's returning any row that means you can't insert those newly (date3, date4) in database. your select query looks like below

Select * from yourtable where StartDate >= date3 and EndDate <= date4

try this and let us know :-)

Hi everybody,

I'm wondering is there a way to check wither a dateTime is selected within particular period.

Let me give a e.g:

suppose I've
date1 = "07/18/2010 08:00"
date2 = "07/18/2010 10:30"

date1 and date2 represent a period of time from 8 to 10 in 18/07.

I want to check that the new entered period date3 and date4 are not intersecting the period above.

e.g.
date3 = "07/18/2010 07:00"
date4 = "07/18/2010 011:00"

I'm working on asp.net VB.NET

Could PLZ hint me how to solve it?

0

rohand my friend your suggestion is 99.99% correct..

but wot if user selects the same start Date and same End Date

wots going to happen.. ?

0

thanks dnanetwork. But i think it will work in those case also. But still i am not sure.. But one thing can you please let us know the proper code or solutions if you find ? thanks a lot.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.