#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Sacramento
    Posts
    50
    Rep Power
    14
    Hello,

    I have a date that is pulled out of a db and displayed like this:

    $date = date("F j, Y");

    which prints something like

    August 18, 2000

    I have another variable that holds the value of a delivery day ie:

    3 Days

    I'd like to add in, this example, 3 days to the date to print
    August 21, 2000

    So if the value is 5 Days:

    The date would be

    August 18, 2000 + 5

    to print : August 23, 2000 and so on depending on the number variable

    Would I use an if /else statement?

    There are a total of three options

    3 days
    5 days
    7 days

    I hope this make sense.

    Thank you very much!
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    This adds 3 days to the current date - I do not know how your date comes out of the db - (format) but have a play and you should sort it out.

    <?
    $da= getdate(mktime());
    $myday=$da['mday']+3;
    echo date( "F j, Y", mktime(0,0,0,$da['mon'],$myday,$da['year']) );
    ?>


    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Sacramento
    Posts
    50
    Rep Power
    14
    The date is a timestamp field from a mysql db.

    I dislplay the date like this:

    $date = $row["CREATED"];
    $date = date("F j, Y");

    I tried your code, but had a hard time getting it to work...

    Thank you !
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Sacramento
    Posts
    50
    Rep Power
    14
    I Just figured it out. It works great!

    Thanks for your time and help!

Similar Threads

  1. Replies: 2
    Last Post: August 18th, 2004, 10:45 PM
  2. Unix : String to date conversion error?
    By tzeyik in forum Java Help
    Replies: 2
    Last Post: January 26th, 2004, 07:11 AM
  3. PHP with UnixODBC
    By coder4hire in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 01:14 PM
  4. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 01:41 PM
  5. Need PHP and XML file conversion on the fly
    By suh in forum PHP Development
    Replies: 0
    Last Post: January 15th, 2004, 04:40 AM

IMN logo majestic logo threadwatch logo seochat tools logo