you should make the column for the time posted in your table to be
Date/time. mysql stores it in this format: 2003-02-24 12:43:45
(year-month-day hours:minutes:seconds)
to allow the current date/time to be inserted into this column
date("Y-m-d G:i:s")

if you want to DISPLAY it in this date format (mm/dd/yy), then anytime you
query the table, just add say for example, DATE_FORMAT(Posted, '%c/%e/%y')
as datePosted

where Posted is column name in your table, and datePosted is the new
variable you want to assign the date to.

to answer your second question to get a records between 2 dates, it's simply
adding this to your query:
...where datePosted BETWEEN '$startthedate' and '$endthedate'

Hope this helped. for more on dates, check out this link:
http://www.php.net/manual/en/function.date.php




"Charles Kline" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all,
>
> I posted earlier with some date questions, but realized I could
> probably do better with my question presented as such.
>
> I need to save the time date and time of posting for the records in a
> table.
> I then need to be able to search via a startdate and enddate text field
> where the user will be entering the date ranges as mm/dd/yyyy.
>
> What is the best way to handle adding the date to the MySQL record, and
> also how to search for that date based on a range in the above stated
> format?
>
> Thanks,
> Charles
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to