Forum Moderators: coopster
<?php
$current = date ("F", strtotime("now"));
$next = date("F", strtotime("next month")); //or try "+1 month"
echo $current.'...'.$next;
?>
My site is launching today and I get August , October. Yesterday it worked correctly. Could this be a bug in the function?
Also strtotime("now") can be replaced with time(), or left out entirely in the date command.
;)
Here's a reference:
[bugs.php.net...]
function makeDropDown() {
$months = array("1"=>"January", "2"=>"February", "3"=>"March", "4"=>"April", "5"=>"May", "6"=>"June", "7"=>"July", "8"=>"August", "9"=>"September", "10"=>"October", "11"=>"November", "12"=>"December");
$cur_index = date ("n", strtotime("now"));
$current = $months["$cur_index"];
$next_index = ($cur_index == '12')? '1' : $cur_index + 1;
$next = $months["$next_index"];
$form = '<div><form method="get" action="'.$_SERVER['PHP_SELF'].'" name="form1">
Show all events scheduled for <select name="month" onchange="form1.submit()">
<option value="">Select a Month</option>
<option value="'.$current.'">'.$current.'</option>
<option value="'.$next.'">'.$next.'</option>
</select><p></p></div>';
return $form;
}
[edited by: jatar_k at 4:59 pm (utc) on Aug. 31, 2005]
[edit reason] fixed sidescroll [/edit]
getdate this and next month [webmasterworld.com]
getdate this and next month etc. [webmasterworld.com]