Date Query

  • Thread starter Thread starter Zwi2000
  • Start date Start date
Z

Zwi2000

Hi.

I have an application that holds BirthDates.
Is there a way to query for all birthdates between two dates without
considering the year ?

Like: Between "April 1" and Dec 10". I knonw who to query between two dates,
but it considers the year.

Any help is appreciated.

Z
 
Zwi2000 said:
Hi.

I have an application that holds BirthDates.
Is there a way to query for all birthdates between two dates without
considering the year ?

Like: Between "April 1" and Dec 10". I knonw who to query between two dates,
but it considers the year.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use the DatePart() function to find the day of the year:

PARAMETERS BeginDate Date, EndDate Date;
SELECT *
FROM Birthdates
WHERE DatePart("y", Birthdate) BETWEEN DatePart("y", BeginDate) And
DatePart("y", EndDate)

When the parameter input boxes appear just enter "4/1" for April 1 and
"12/10" for Dec 10. The parameter input box automatically appends the
current year.

The problem with this is leap year.

If Year(BirthDate) Mod 4 = 0 Then it is a leap year.


--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQH2Pa4echKqOuFEgEQIrZgCffTjMpqBy9jNZTurxQlPq5/kJaKwAni5R
a7QYWWdVeZouNt9TInFmK9sS
=X9Rz
-----END PGP SIGNATURE-----
 
Zwi2000 said:
Hi.

I have an application that holds BirthDates.
Is there a way to query for all birthdates between two dates without
considering the year ?

Like: Between "April 1" and Dec 10". I knonw who to query between two dates,
but it considers the year.

Any help is appreciated.

Z

Hi Zwi2000,

I'm sure there are many ways to solve this. But here is one solution
I've tested. I would create another table to include names and only
MonthDay (formatted as MMDD) for birthdays. You can then use this
table to do your query.

Have a nice day!
 
Back
Top