Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check that 2 dates are between 2 other dates
Message
De
28/09/2004 15:47:52
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00946137
Message ID:
00946890
Vues:
23
This message has been marked as the solution to the initial question of the thread.
>Hi Himlar,
>
>What I am try trying to achieve is this:
>
>I have 2 date ranges
>
>1. My user entered date range ie the date range the user wants to schedule in the diary.
>
>The treatment date range ie the usual date period in the year that the treatments is done.
>
>So if any of the dates between (or including) the start & end date of the user entered date range is between (or including) the treatment date range, then I want to do some code.
>
>Hope this is clear. In theory the treatment date range can be smaller than the entered date range or vice versa.
>
>TIA

Is this of help?
*	This function expects a From-Thru period and startdate and enddate (e.g. from the employee). 
*	It'll tell you whether (e.g. the person is an employee) within or somewhere within the period.
FUNCTION FoundInPeriod( tdFrom, tdThru, tdSdate, tdEdate )
	*
	RETURN Empty( tdEdate ) and tdSdate <= tdThru ) ;
		   or ;
	       ( not Empty( tdEdate ) and ( Between( tdSdate, tdFrom, tdThru )   or Between( tdEdate, tdFrom, tdThru  ) ) ) ;
		   or ;
	       ( not Empty( tdEdate ) and ( Between( tdFrom, tdSdate, tdEdate ) and Between( tdThru, tdSdate, tdEdate ) ) )

	*   if empty edate:
	*                         sdate ................................................................................
	*                           |
	*   no  |--------------|
	*   yes      |--------------|
	*   yes            |--------------|
	*   yes                          	|--------------|

	*   if filled edate:
	*                         sdate ..............................................edate
	*                           |                                                   |
	*   no  |--------------|
	*   yes      |--------------|
	*   yes            |--------------|
	*   yes                          	|--------------|
	*   yes                          	                                     |--------------|
	*   yes                                                                         |--------------|
	*   no                                                                                |--------------|
	*   yes                |-------------------------------------------------------------------|
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform