SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Next Month

  1. #1
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Next Month

    Hi,

    How can you find the next month? Ie. This month is 'September' how can I get October in PHP? Must be full names, so "F" in date() function, but I can't get then next month.

    Any ideas?

    -Peter

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to use a combination of mktime() and date()

    PHP Code:
    $nmonth date("F"mktime(0,0,0,date("m") + 1));
    print 
    $nmonth
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    epsilon transition cupid's Avatar
    Join Date
    Aug 2001
    Location
    Kent, Ohio
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    date("M",mktime()+2419200) should do the trick

    oops freddie beat me to it

  4. #4
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for such quick replies...works like a charm!

    -Peter


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •