Mo
Di
Mi
Do
Fr
Sa
So
30
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
01
02
03

<?php
function monthBack$timestamp ){
    return 
mktime(0,0,0date("m",$timestamp)-1,date("d",$timestamp),date("Y",$timestamp) );
}
function 
yearBack$timestamp ){
    return 
mktime(0,0,0date("m",$timestamp),date("d",$timestamp),date("Y",$timestamp)-);
}
function 
monthForward$timestamp ){
    return 
mktime(0,0,0date("m",$timestamp)+1,date("d",$timestamp),date("Y",$timestamp) );
}
function 
yearForward$timestamp ){
    return 
mktime(0,0,0date("m",$timestamp),date("d",$timestamp),date("Y",$timestamp)+);
}

function 
getCalender($date,$headline = array('Mo','Di','Mi','Do','Fr','Sa','So')) {
    
$sum_days date('t',$date);
    
$LastMonthSum date('t',mktime(0,0,0,(date('m',$date)-1),0,date('Y',$date)));
    
    foreach( 
$headline as $key => $value ) {
        echo 
"<div class=\"day headline\">".$value."</div>\n";
    }
    
    for( 
$i 1$i <= $sum_days$i++ ) {
        
$day_name date('D',mktime(0,0,0,date('m',$date),$i,date('Y',$date)));
        
$day_number date('w',mktime(0,0,0,date('m',$date),$i,date('Y',$date)));
        
        if( 
$i == 1) {
            
$s array_search($day_name,array('Mon','Tue','Wed','Thu','Fri','Sat','Sun'));
            for( 
$b $s$b 0$b-- ) {
                
$x $LastMonthSum-$b;
                echo 
"<div class=\"day before\">".sprintf("%02d",$x)."</div>\n";
            }
        } 
        
        if( 
$i == date('d',$date)) {
            echo 
"<div class=\"day current\">".sprintf("%02d",$i)."</div>\n";
        } else {
            echo 
"<div class=\"day normal\">".sprintf("%02d",$i)."</div>\n";
        }
        
        if( 
$i == $sum_days) {
            
$next_sum = (array_search($day_name,array('Mon','Tue','Wed','Thu','Fri','Sat','Sun')));
            for( 
$c 1$c <=$next_sum$c++) {
                echo 
"<div class=\"day after\"> ".sprintf("%02d",$c)." </div>\n"
            }
        }
    }
}
?>
<html>
<head>
<style type="text/css">
body {
    font-family:verdana;
    font-size:12px;
}
a {
    color:black;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
    background: #14A1FF;
}
.calender {
    width:280px;
    border:8px solid #14A1FF;
}
* html .calender,
* + html .calender {
    width:282px;
}
.calender div.after,
.calender div.before{
    color:silver;
}
.day {
    float:left;
    width:40px;
    height:40px;
    line-height: 40px;
    text-align: center;
}
.day.headline {
    background:#427BD6;
    color:white;
    font-weight: bold;
}
.day.current {
    font-weight:bold;
    background: #73C6EF;
    color:white;
}
.clear {
    clear:left;
}
.pagination {
    text-align: center;
    line-height:20px;
    font-weight: bold;
    color:white;
    background:#427BD6;
}
.pagination a {
    width:20px;
    height:20px;
    float:left;
    color:white;
}
.pagination span {
    display:block;
    float:left;
    width: 200px;
}
.clear {
    clear:both;
}
</style>
</head>
<body>
<?php

if( isset($_REQUEST['timestamp'])) $date $_REQUEST['timestamp'];
else 
$date time();

$arrMonth = array(
    
"January" => "Januar",
    
"February" => "Februar",
    
"March" => "M&auml;rz",
    
"April" => "April",
    
"May" => "Mai",
    
"June" => "Juni",
    
"July" => "Juli",
    
"August" => "August",
    
"September" => "September",
    
"October" => "Oktober",
    
"November" => "November",
    
"December" => "Dezember"
);
    
$headline = array('Mo','Di','Mi','Do','Fr','Sa','So');

?>

<div class="calender">
    <div class="pagination">
        <a href="?timestamp=<?php echo yearBack($date); ?>" class="last">|&laquo;</a> 
        <a href="?timestamp=<?php echo monthBack($date); ?>" class="last">&laquo;</a> 
        <span><?php echo $arrMonth[date('F',$date)];?> <?php echo date('Y',$date); ?></span>
        <a href="?timestamp=<?php echo monthForward($date); ?>" class="next">&raquo;</a>
        <a href="?timestamp=<?php echo yearForward($date); ?>" class="next">&raquo;|</a>
        <div class="clear"></div>  
    </div>
    <?php getCalender($date,$headline); ?>
    <div class="clear"></div>
</div>

</body>
</html>