I can't get this figured out. I'm trying to add one month to a date so that I can have a dynamic field based upon a timestamp that is put into a database. As it stands today I have a timestamp of '2011-05-31 19:29:52' in the variable $LastUpdateStampPDdt. I do the following:

$date = date('M-y', strtotime($LastUpdateStampPDdt . " +1 month"));

and it gives me Jul-11. I'm trying to get Jun-11 so then I go:

$date2 = date('M-y', strtotime($LastUpdateStampPDdt . " +2 month"));

and it also gives me Jul-11 (which is what I want)...
How do I get the first one to show me Jun-11? Does the method have to be changed for how I'm doing it?

    Why not just SELECT the future date and let the DB take care of it?

    SELECT date_col + INTERVAL 1 MONTH AS future_date, ...

      Wow, that is so much better! Thank you, here's my final code

      $LastUpdateQueryPD = "SELECT TimeStamp,
      TimeStamp + interval 1 month as month0,
      TimeStamp + interval 2 month as month1,
      TimeStamp + interval 3 month as month2,
      TimeStamp + interval 4 month as month3,
      TimeStamp + interval 5 month as month4,
      TimeStamp + interval 6 month as month5,
      TimeStamp + interval 7 month as month6,
      TimeStamp + interval 8 month as month7,
      TimeStamp + interval 9 month as month8,
      TimeStamp + interval 10 month as month9,
      TimeStamp + interval 11 month as month10,
      TimeStamp + interval 12 month as month11
      FROM tblpdatasum LIMIT 1";
      $LastUpdateResultPD = mysql_query($LastUpdateQueryPD) or die(mysql_error().'<br />');
      while ($Row = mysql_fetch_assoc($LastUpdateResultPD))
      {
      $LastUpdateStampPD = convert_datetime($Row["TimeStamp"]);
      $Month0 = date('M-y', strtotime($Row["month0"]));
      $Month1 = date('M-y', strtotime($Row["month1"]));
      $Month2 = date('M-y', strtotime($Row["month2"]));
      $Month3 = date('M-y', strtotime($Row["month3"]));
      $Month4 = date('M-y', strtotime($Row["month4"]));
      $Month5 = date('M-y', strtotime($Row["month5"]));
      $Month6 = date('M-y', strtotime($Row["month6"]));
      $Month7 = date('M-y', strtotime($Row["month7"]));
      $Month8 = date('M-y', strtotime($Row["month8"]));
      $Month9 = date('M-y', strtotime($Row["month9"]));
      $Month10 = date('M-y', strtotime($Row["month10"]));
      $Month11 = date('M-y', strtotime($Row["month11"]));
      }

        Whoa... didn't realize you wanted more than one of them. Seems to me like it'd be a lot simpler/easier/"better" to just get the first date and loop...

        // just get the original timestamp, will assume it's in $Row['TimeStamp']
        // replace NUM_ITERATIONS with an appropriate value
        // replace FORMAT_STRING with an appropriate value
        for($dates = array(), $date = new DateTime($Row['TimeStamp']), $i = 0; $i < NUM_ITERATIONS; $i++)
            $dates[] = $date->add(new DateInterval('P1M'))->format(FORMAT_STRING);

          Even that might be going a bit far: it's not as if the sequence of month names changes very often.

          $this_year = date('Y');
          $months = array(null, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
          $this_month = date('m');
          $dates = array();
          foreach(array_slice($months, $this_month, 12) as $month)
          {
              $dates[] = $month . '-' . $this_year;
              if($month=='Dec') $this_year++;
          }
          
            Write a Reply...