|
Posted by gerg on 12/20/05 09:51
Tyrone Slothrop wrote:
> On Mon, 19 Dec 2005 00:42:15 -0800, gerg <noemail@noemail.com> wrote:
>
>
>>>In MySQL a date would be saved in the format yyyy-mm-dd and, if you
>>>stored the value in that format, the query would be like:
>>>SELECT * FROM table WHERE (birthdate >= CURRENT_DATE() OR birthdate <=
>>>DATE_ADD(CURRENT_DATE(),INTERVAL 30 DAY);
>>
>>Tyrone, Thanks alot. I'm gonna give this a shot. So, the
>>current_date() function will look for the format of yyy-mm-dd ? I'm
>>actually inserting the birthdays in the mm-dd-yyyy format. Will this
>>make a difference? I'm assuming it will, so I will alter the script to
>>submit in the other format.
>>
>>The INTERVAL 30 DAY, is specifying to look out 30 days? I'm assuming
>>changing this number will allow me to return different amount of days to
>>go out? It seems like the main thing to make this work is how I submit
>>the original birthday dates in the database. Thanks again tyrone!
>>
>>Greg
>
>
> The DATE_ADD() SQL function allows you to look for dates in days,
> months, or years.
>
> The structure of the date value is very important so you are going to
> have to watch the structure when saving the data. I usually use
> select boxes (dropdowns) to select the month, day and year. When
> saving, you can build the value:
> $qy = "INSERT INTO table SET date =
> \"".$_POST['year']."-".$_POST['month']."-".$_POST['day']."\"";
>
Hey man, you've been a great help. Thanks for taking the time.
Happy Holidays.
Greg
[Back to original message]
|