Log in

View Full Version : Date/Time Problems



onestopplay
01-08-2010, 10:01 PM
I have 2 date columns in a database:
start_date | end_date

When someone submits "form a", I want it to add the current date&time to "start_date" and then I want it to put the current date&time + 3 days into the "end_date" column.

Then I will have a mysql_query like this:
mysql_query("SELECT * FROM table WHERE id='$id'");
with a while loop of course.
But, I also want it to only show results in between the start and end dates.

How can I do this??

THANKS!!

Nile
01-08-2010, 10:20 PM
If you just want to know how to add to days to the time, use time() for current date, and time() + (3 * 24 * 60 * 60) for date + 3 days.

But - if your inserting it into a database using date(), use date("whatever in here") for current date, and date("whatever in here", strtotime("+3 days"));

onestopplay
01-08-2010, 11:38 PM
How do I make my mysql_query to only have results in between the two dates?
Thanks!