Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wich Birthdays for two given dates
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00363237
Message ID:
00363416
Views:
12
Hi Nick,

>>This works too, I just didn't give the my original too much thought
>>lnyear = YEAR(DATE())
>>SELECT *;
>>  FROM CLIENTS;
>>  WHERE BETWEEN(DATE(lnyear, MONTH(clients.dob), DAY(clients.dob)), dstart, dend)
Empty birthdates shouldn't be allowed.< g >
>
>This will not work properly if dstart and dend belong to different years, i.e for the period starting say, in November and ending in February.
>
>This one-liner will work in VFP 3, 5, 6 and 7 :) and it is not using any kind of date parsing, concatenation and CTOD() stuff.
>
>SELECT * FROM CLIENTS ;
>WHERE BETWEEN(GOMONTH(birth_date,(YEAR(start_date)- YEAR(birth_date))*12), start_date, end_date ) ;
>OR BETWEEN(GOMONTH(birth_date,(YEAR(end_date)- YEAR(birth_date))*12), start_date, end_date)

As always, this simple task could be done in at least three ways, but your solution seems to be more efficient and elegant. :)
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform