Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Birthdays this week
Message
 
 
To
19/03/2009 13:17:20
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01389309
Message ID:
01392084
Views:
108
Invalid day parameter for DATE() function does not generate an error in a query but produces empty date. EVL() or IIF in VFP7 and earlier can be used to replace Feb. 29 with Feb. 28 in such case assuming that all DOBs are valid dates (not empty or null).
SELECT * ;
	FROM People ;
	WHERE ;
			EVL(DATE(YEAR(ldStartDate), MONTH(dob), DAY(dob)),  ;
				DATE(YEAR(ldStartDate ), MONTH(dob), DAY(dob-1))) ; 
					BETWEEN ldStartDate AND ldEndDate ;
		OR ;
			EVL(DATE(YEAR(ldEndDate), MONTH(dob), DAY(dob)),  ;
				DATE(YEAR(ldEndDate), MONTH(dob), DAY(dob-1))) ;
					BETWEEN ldStartDate AND ldEndDate
>The date() function in your example would fail fail if a person happened to be born on Feb. 29 - I believe that I'll have to convert those dates to Feb. 28, using an iif().
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform