Wochenanfang auf Deutsch umstellen im Kalender

jonny1024

Grünschnabel
Hallo.
Brauche Hilfe. Muss den Kalender auf das Deutsche Format umstellen.
Also die Woche von Mo-So.
Bin am verzweifeln.

PHP:
<?
function time_deutsch($time){
	list($std, $min, $sec) = explode(":", $time);
         return sprintf("%02d:%02d",$std, $min);
}

	$monate = array(1 => 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember');

	$currentday = date("j", time());
	$currentmonth = date("n", time());
	$currentyear = date("Y", time());

	$lastday = 1;

	if (!$month)
	{
		$month = date("n", time());
		$year = date("Y", time());
	}


	echo "<center><font face=Arial size=5><b>";
	echo $monate[$month];
	echo " $year<p><font size=3></b><p>";

	$firstday = date( 'w', mktime(0,0,0,$month,1,$year));
	while (checkdate($month,$lastday,$year))
	{
	        $lastday++;
	}

	$nextmonth = $month+1;
	$nextyear = $year;
	if ($nextmonth == 13)
	{
		$nextmonth = 1;
		$nextyear = $year + 1;
	}
	$lastmonth = $month-1;
	$lastyear = $year;
	if ($lastmonth == 0)
	{
		$lastmonth = 12;
		$lastyear = $year-1;
	}

	echo "<table><tr>";
        echo "<td><form method=post action=test4.php><input type=submit value='<<'>
                <input type=hidden name=month value=$lastmonth>
                <input type=hidden name=year value=$lastyear></form></td>";
        echo "<td>-----------</td>";
        echo "<td><form method=post action=test4.php><input type=submit value='>>'>
                <input type=hidden name=month value=$nextmonth>
                <input type=hidden name=year value=$nextyear></form></td></tr></table>";


	echo "<table width=100% cellpadding=5 cellspacing=5 border=1>";
	echo "<tr><td width=14%><b>Sonntag</td><td width=14%><b>Montag</td>
		  <td width=14%><b>Dienstag</td><td width=14%><b>Mittwoch</td>
		  <td width=14%><b>Donnerstag</td><td width=16%><b>Freitag</td>
		  <td width=14%><b>Samstag</td></tr>";

	for ($i=0; $i<7; $i++)
	{
		if ($i < $firstday)
		{
			echo "<td></td>";
		}
		else
		{
			$thisday = ($i+1)-$firstday;
			
			if ($currentyear > $year)
			{
				echo "<td valign=top bgcolor=dddddd>";
			}
			else if ($currentmonth > $month && $currentyear == $year)
			{
				echo "<td valign=top bgcolor=dddddd>";
			}
			else if ($currentmonth == $month && $currentday > $thisday && $currentyear == $year)
			{
				echo "<td valign=top bgcolor=dddddd>";
			}
			else
			{
				echo "<td valign=top bgcolor=white>";
			}
                        
                         echo "<a href=display.php?day=$thisday&month=$month&year=$year>$thisday.</a><br><hr><font size=2>";
			
   			for ($j=0; $j4; $j++)
			{	
				echo "<br>";
			}
			echo "</td>";

		}
	}

	echo "</tr>\n";
	$nextday = ($i+1)-$firstday;

	for ($j = 0; $j<5; $j++)
	{
		echo "<tr>";
		for ($k = 0; $k<7; $k++)
		{
			if ($nextday < $lastday)
			{
				if ($currentyear > $year)
                                {
                                        echo "<td valign=top bgcolor=dddddd>";
                                }
				else if ($currentmonth > $month && $currentyear == $year)
                        	{
                               		echo "<td valign=top bgcolor=dddddd>";
                        	}
                        	else if ($currentmonth == $month && $currentday > $nextday && $currentyear == $year)
                        	{
                                	echo "<td valign=top bgcolor=dddddd>";
                        	}
                        	else
                        	{
                               		echo "<td valign=top bgcolor=white>";
                        	}
				echo "<a href=display.php?day=$nextday&month=$month&year=$year>$nextday.</a><br><hr><font size=2>";
				echo "</td>";
				$nextday++;
			}
		}
		echo "</tr>\n";
	}

	echo "</table><font size=3>";


	echo "<table><tr>";
	echo "<td><form method=post action=test4.php><input type=submit value='<<'>
		<input type=hidden name=month value=$lastmonth>
		<input type=hidden name=year value=$lastyear></form></td>";
	echo "<td>---------</td>";
	echo "<td><form method=post action=test4.php><input type=submit value='>>'>
		<input type=hidden name=month value=$nextmonth>
		<input type=hidden name=year value=$nextyear></form></td></tr></table>";
?>

Danke im voraus.
 
Zuletzt bearbeitet:
Zurück