I've just built a small function to do some date calculation based on a string passed to the function.
My problem is that when I try and return the date, all I get printed on screen is array.
Any ideas?
function GetDate($submit) { //Date Calculation based upon String
if($submit == "Prev"){
$submit = date ("Y-m-d", strtotime ("-1 month"));
echo $submit;
} elseif($submit == "Next"){
$submit = date ("Y-m-d", strtotime ("+1 month"));
echo $submit;
} else {
$submit = date("Y-m-d", strtotime ("Now"));
echo $submit;
}
return($submit);
}
Calling the function like this:
$submit = "Next"; // Testing Variable
echo GetDate($submit);