Hi All.
im having trouble with the date function, Basicly I am trying to display the month and have the date increment once a link has been pressed, or decremented, but forgot this for now,
I think I need to use sometime of loop to increment the month, but im lost and hence asking for help
<?php
// set the date variable to NOW
$date=mktime();
// Check the current date
echo "<a href=date.php?month=decrement><</a>";
echo "\tDate is now: ".date("d-M-Y",$date);
echo "<a href=date.php?month=increment>\t></a><br>";
//increment month
if(isset($_REQUEST['month']) AND $_GET['month'] == 'increment'){
// add 1 years, 0 months and subtract 0 day
$date=mktime();
$years_to_add =0;
$months_to_add =1;
#months_to_add++;
$days_to_add = 0;
#$months_to_add++;
$date=mktime(0,0,0,
date("m",$date)+$months_to_add,
date("d",$date)+$days_to_add,
date("Y",$date)+$years_to_add
);
// Check the current date again
echo "<a href=date.php?month=decrement><</a>";
echo "Date is now: ".date("d-M-Y",$date);
echo "<a href=date.php?month=increment>\t></a><br>";
#months_to_add + 1;
#echo "Date is now: ".date("d-M-Y",$date);
}
?>
I really hope someone can help, I experence with date is very limited,
thanks all for reading