PHP Tutorial

PHP + SQL Scripts Functions Classes
PHP / Scripts / Previous - Next Month
Last modi. : 11-September-2021 03:08:55

<?php 

if(isset($_GET["ShowMonth"])){ 
	$_GET["ShowMonth"]=addcslashes($_GET["ShowMonth"]); $ShowYearMonth=$_GET["ShowMonth"]; 
	} else { $ShowYearMonth=date("Y-m"); }
list($ShowYear, $ShowMonth)=explode('-', $ShowYearMonth);
$BackMonth =  date("Y-m", mktime(0, 0, 0, $ShowMonth-1  , 1, $ShowYear)); // One Month Back
$NextMonth =  date("Y-m", mktime(0, 0, 0, $ShowMonth+1  , 1, $ShowYear)); // NextMonth
?>