Author Topic: next month  (Read 199 times)

0 Members and 1 Guest are viewing this topic.

Offline jeff5656Topic starter

  • Devotee
  • Posts: 679
    • View Profile
next month
« on: November 20, 2008, 05:19:28 PM »
the following gives me November, which is what I want.
Code: [Select]
$curr_month = date (F);
Now how do I get NEXT month?  So it displays "December"?
I tried this but it doesn't work.  I have a bad feeling I need to use mktime but that gives me stomach aches trying to figure it out!

Code: [Select]
<?php
echo date (F);
$nextmonth date("F")+1;
echo 
$lastmonth;
?>
« Last Edit: November 20, 2008, 05:21:10 PM by jeff5656 »

Offline Blade280891

  • Addict
  • Posts: 2,496
  • Gender: Male
  • Mr.Grumpypants
    • View Profile
Re: next month
« Reply #1 on: November 20, 2008, 05:22:23 PM »
Code: [Select]
<?php
echo strtotime("+1 month");
?>
Read the rules http://www.phpfreaks.com/page/rules-and-terms-of-service#toc_forum_guidelines

Quote
99.9% of my replies are correct, the other 0.1% means you asked the wrong question

Offline jeff5656Topic starter

  • Devotee
  • Posts: 679
    • View Profile
Re: next month
« Reply #2 on: November 20, 2008, 06:17:23 PM »
No if i do
Code: [Select]
<?php
echo strtotime("+1 month");

I get this:1229815057

How do i get "December" (or whatever the next month is)

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,256
    • View Profile
Re: next month
« Reply #3 on: November 20, 2008, 06:27:44 PM »
Code: [Select]
<?php

echo date("F"strtotime("+1 month"));

?>

Offline Blade280891

  • Addict
  • Posts: 2,496
  • Gender: Male
  • Mr.Grumpypants
    • View Profile
Re: next month
« Reply #4 on: November 20, 2008, 06:31:55 PM »
Oopz sorry should of mentioned that you need to put it in the date();
Read the rules http://www.phpfreaks.com/page/rules-and-terms-of-service#toc_forum_guidelines

Quote
99.9% of my replies are correct, the other 0.1% means you asked the wrong question