Results 1 to 3 of 3

Thread: Date/Time Problems

  1. #1
    Join Date
    Jun 2009
    Posts
    62
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default Date/Time Problems

    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!!

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    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"));
    Jeremy | jfein.net

  3. #3
    Join Date
    Jun 2009
    Posts
    62
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default

    How do I make my mysql_query to only have results in between the two dates?
    Thanks!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •