Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check that 2 dates are between 2 other dates
Message
De
27/09/2004 20:43:54
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00946137
Message ID:
00946499
Vues:
12
I think you want to avoid conflicts between two date ranges, is that right?

There is no conflict between two date ranges, if (assuming the ranges are defined as Start1-End1 and Start2-End2):

Start1 > = End2 OR Start2 > = End1

Negating this, you get the condition for a conflict. That is, you have a conflict if:

Start1 < End2 AND Start2 < End1

HTH, Hilmar.

>Hi! I have a form that allows the user to enter a date range. The program then scans through a table looking for treatments that are done at any time during the entered period ie between two dates.
>
>So treatment 1 is usually done between 03/02 and 04/28.
>treatment 2 between 05/01 and 05/15. etc etc
>
>
>The only way I can think to do this is to loop from the entered start & end date a day at a time and check that that date falls between each treatment.
>This works fine but is a little slow, keep thinking there must be a way of doing this using an equation/syntax.
>
>Thinking about this makes my head hurt! LOL, Any ideas?
>
>Hope this makes sense!
>
>TIA
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform