Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DateTime Range Challenge
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00807668
Message ID:
00807697
Views:
20
This message has been marked as a message which has helped to the initial question of the thread.
Try
... WHERE (tBegin BETWEEN ltBeginPeriod AND ltEndPeriod) OR ;
   (tEnd BETWEEN ltBeginPeriod AND ltEndPeriod)
>Hello Foxperts
>
>My current challenge is to develop an expression that will assist in selecting or filtering records in a table that has two DateTime fields that describe when a particular condition is happening.
>
>tBegin is a DateTime field
>tEnd is a DateTime field
>Together they describe a period of time
>
>I need to select all records that intersect a given period of time - this is something like set theory.
>
>Let's say that I'm interested in records that affect the time periond described as being from {^2003-07-04,15:30} to {^2003-07-07.06:30}.
>
>Record 1 tBegin={^2003-07-04,15:30}; tEnd={^2003-07-07,06:30}; is included.
>Record 2 tBegin={^2003-07-04,01:00}; tEnd={^2003-07-04,23:30}; is included.
>Record 3 tBegin={^2003-07-01,12:10}; tEnd={^2003-07-03,21:15}; is excluded.
>Record 4 tBegin={^2003-07-06,05:30}; tEnd={^2003-07-08,06:30}; is included.
>Record 5 tBegin={^2003-07-07,08:45}; tEnd={^2003-07-07,11:30}; is excluded.
>
>Here's a graphic attempt to describe the same thing:
>0 = not in time range
>1 = in time range
>00000111100000 <- user described time range
>00011110000000 <- record included
>00000001111000 <- record included
>00000011000000 <- record included
>01110000000000 <- record excluded
>00000000001111 <- record excluded
>
>Is this a monster IF or something that includes multiple BETWEEN()s, or a DO CASE???
>
>TIA for your prompting that will get me started.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform