Forum Moderators: coopster
<?php
$month = date("n");
$year = date("Y");
$firstDay = mktime(0,1,0,$month,1,$year);
$daysInMonth = date("t",$firstDay);
$firstDay = date("w",$firstDay);
?>
<?php
echo "<div class='section group'>";
echo "<div class='col span_1_of_3 prev'>Prev</div>\n";
echo "<div class='col span_1_of_3 current'>" . date("F Y") . "</div>\n";
echo "<div class='col span_1_of_3 next'>Next</div>\n";
echo "</div>";
?>
$nextmonth = mktime(0, 0, 0, date("m")+1, date("d"), date("Y"));
$lastmonth = mktime(0, 0, 0, date("m")-1, date("d"), date("Y"));
$nextmonth = date('F Y', strtotime('+1 month'));
echo $nextmonth. "<br>";
$lastmonth = date('F Y', strtotime('-1 month'));
echo $lastmonth;
<a href="mycalendar.php?date=2015-12-14">Previous Month</a>
<a href="mycalendar.php?date=2016-02-14">Next Month</a>
session_start();
if (is_set($_SESSION['date']) $date=$_SESSION['date'];
else $date=time();
$nextmonth = mktime(0, 0, 0, date("m",$date)+1, date("d",$date), date("Y",$date));
$lastmonth = mktime(0, 0, 0, date("m",$date)-1, date("d",$date), date("Y",$date));
if ($_GET['go']==1) $date=$nextmonth;
if ($_GET['go']==-1) $date=$lastmonth;
//after processing etc...
$_SESSION['date']=$date;
//now use $date for your output...