Jump to content

[SOLVED] Trying To Use Time Function To Return Next Month


refiking

Recommended Posts

I am using a calendar script that uses the current time to show the current month's calendar.  What I am trying to do is get the next month's calendar to be returned.  I've tried to use the mktime function, but am at a loss so far.  What do I need to do?  Here's what I have so far.

 

$time = time();
$nmonth = time("+1 Month");

 

If you do it that way, you have the potential to end up with a month 13, which it will probably understand as 1 plus one year, but maybe not. Your best bet is to use strtotime.

 

You don't even need the time() function like in your code...just strtotime().  It implicitly uses 'now' as the default timestamp:

 

<?php
$nextmonth = strtotime('+1 month');
?>

It does. Complete operator error.  The calendar has two seperate $nmonth variables.  The first (which I overlooked) is for the Header Line and the second one is for the actual calendar.  Switched it and now works perfectly.  Thanks again!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.