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

    Join Date
    May 2000
    Posts
    2
    Rep Power
    0
    Hello:

    I have a variable ($today) that is simply

    $today = date("m/j/Y");

    I want to get another variable for x months down the line, but using the php.net reference of the mktime and date command, my second date, as follows comes out in a large number. How can I make sure it is forwarding the date properly, and format it like mm/dd/yyyy? Any help would be greatly apperciated.

    This is the line from php.net reference page. I need this to calculate properly, and format mm/dd/yyyy - just like my variable up top.

    $two_months_from_today = mktime(0,0,0,date("m")+2 ,date
    ("d"),date("Y"));


    ------------------
    .: jawatech.com :.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Ontario, Canada
    Posts
    498
    Rep Power
    18
    Just a suggestion, I can't really prove this theory at the moment since I have no access to a webserver with PHP, but you can set a second variable that holds a formatted date string using the "large number" generated from mktime like this:

    $retval = date("m/j/Y",$two_months_from_today);

    ------------------
    To alcohol! The cause of, and solution to, all of life's problems. -- Homer Simpson
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    2
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by cka:
    Just a suggestion, I can't really prove this theory at the moment since I have no access to a webserver with PHP, but you can set a second variable that holds a formatted date string using the "large number" generated from mktime like this:

    $retval = date("m/j/Y",$two_months_from_today);

    [/quote]

    It works! Very nice! Thanks!



    ------------------
    .: jawatech.com :.

Similar Threads

  1. Calculating Start and Ending Dates for a Week
    By jjngo in forum PHP Development
    Replies: 5
    Last Post: February 5th, 2006, 05:16 AM
  2. SELECT future dates problem
    By karassik in forum MySQL Help
    Replies: 5
    Last Post: November 30th, 2003, 04:45 PM
  3. Calculating Span between Earliest and Latest Dates
    By simonmaduro in forum PHP Development
    Replies: 3
    Last Post: September 5th, 2003, 04:48 PM
  4. calculating dates
    By Moichi in forum PHP Development
    Replies: 2
    Last Post: January 25th, 2002, 10:15 AM
  5. Pulling a range of future dates w/ MySQL datetime
    By mstembri in forum PHP Development
    Replies: 4
    Last Post: March 24th, 2001, 02:47 AM

IMN logo majestic logo threadwatch logo seochat tools logo