There are a whole heap of very useful date functions in chapter 7 of the
manual that will make all your problems disappear.

----- Original Message -----
From: "Roo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 02, 2001 23:00
Subject: Date comparisions...


> Hi all,
>
> I was recently attempting what I thought would be an easy search. I wanted
> to return all records with a birthdate (a DATE column) 'within' 30 days of
> the current date.
>
> The birthdate is stored as a YYYY-MM-DD, I have been having lots of
trouble
> getting MySQL to return the correct records, my problems are..
>
> 1.I need to ignore the year value as all birthdates will be previous to
the
> current if the year is included.
> 2.I need to check if a birthdate is in the same month as the current month
> and that its day is not less than the current day.
> 3.Then I need to check how many days there are left in the current month,
> take it away from 30 and then check for birthdates in the following month
> within that many days.
>
> So much for being a simple problem!
>
> Anyone have any experience of doing this..?
>
> LINUX..MySQL 3.22.32 on apache
>
> thanks a bunch for any info
>
> Rolf
>
> ___________________________________________
> Computer games don't affect kids,
> I mean if pac man affected us as kids,
> we'd all run around in a darkened room
> munching pills and listening to repetitive music
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to