1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Columbus, OH 43212
    Rep Power
    I having troubles adding numbers to an existing date that is pulled from a database.
    Here's the setup:
    A date is stored in the database, (YYYY-MM-DD). The next record must be assigned the next days date, based on whatever the date of the previous record was.

    I'm using the following code based on other date adding posts I found here at DevShed:

    $sql = "SELECT * FROM Quotes";
    $result = mysql_query($sql);
    $myrow = mysql_fetch_array($result);
    $lastdate = $myrow["QuoteDate"];
    $tomorrow = mktime(0,0,0,date("m",$lastdate) ,date("d",$lastdate)+1,date("Y",$lastdate));
    $nextday = date("Y-m-d",$tomorrow);

    $lastdate is the date of the last record in the DB, and $nextday is supposed to hold $lastdate + 1 - but its failing and giving me the 1970-01-01 issue.

    I hope all that read this understand what I'm trying to accomplish - any help is much appreciated. Thanks
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Bucharest, Romania
    Rep Power
    Moog, I think that in order to obtain a valid timestamp (I mean, ready to be inserted in the database) with "date" function you have to give "YmdHis" parameter.

Similar Threads

  1. database date selection problem
    By kidsleep in forum MySQL Help
    Replies: 0
    Last Post: January 31st, 2004, 10:50 AM
  2. date addition problem
    By strange1 in forum PHP Development
    Replies: 3
    Last Post: October 6th, 2003, 04:01 PM
  3. Javascript date validation: advance to next valid date
    By TruckStuff in forum JavaScript Development
    Replies: 2
    Last Post: September 19th, 2003, 11:21 AM
  4. problem using date as filter for record
    By FrequeNC in forum ASP Programming
    Replies: 4
    Last Post: September 9th, 2003, 04:56 AM
  5. Replies: 8
    Last Post: July 14th, 2003, 03:08 PM

IMN logo majestic logo threadwatch logo seochat tools logo