php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18636 Where is February?
Submitted: 2002-07-30 04:41 UTC Modified: 2002-07-30 04:44 UTC
From: mypsycho101 at hotmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.2.2 OS: WinNT
Private report: No CVE-ID: None
 [2002-07-30 04:41 UTC] mypsycho101 at hotmail dot com
I wanted to list all the months, days and years. The script that I used written below.

$year = date("Y");
$month  = date("m");
$mday = date("d");
get_date($month,$mday,$year,"airway_month","airway_day","airway_year");



function get_date($month,$day,$year,$moname,$dayname,$yearname)
{
	//get the month
	print "<select name=\"$moname\">\n<option value=\"0\">Month</option>";
	for ($m=1;$m<=12;$m++)
	{
		if ($m <10)
			$nm = "0".$m;
		else
			$nm=$m;
		print "<option value=\"".$nm."\">".date("F",mktime(0,0,0,$m,$day,$year))."</option>\n";
	}
	print "</select>\n/\n";

		// get the day
	print "<select name=\"$dayname\">\n<option value=\"0\">Date</option>\n";
	$limit = 31; 
  	for ($d=1;$d<=$limit;$d++)
	{
		if ($d < 10) $nd= "0".$d; else $nd = $d;
			print "<option value=\"".$nd."\">".$nd."</option>\n";
	}
  	print "</select>\n/\n";

  	// get the year
  	$yr_strt = $year - 1;
  	$yr_end = $year + 5;
  	print "<select name=\"$yearname\">\n<option value=\"0\">Year</option>\n";

  	for ($y=$yr_strt;$y<=$yr_end;$y++)
	{
		echo "<option value=\"".$y."\">".$y."</option>\n";
	}
  	print "</select>\n";
}


When I view my HTML source, the month of February is not displayed. Instead there would be two instances of March. I would appreciate if you would inform me if there is something wrong with the script or function. Thank you.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-30 04:44 UTC] rasmus@php.net
Uh, look at the date of this bug report.  Then think about how many days are in February.  Then look at your code.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC