rwzdoorn
rwzdoorn

Reputation: 625

Translate month

I'm currenty looking into this tutorial to create a calendar. The only problem I have atm is that my months are in english instead of dutch. How can I change the output of 'july' to 'juli' ?

<?php 
$vandaag = date("d"); // Current day
$maand = date("m"); // Current month
$jaar = date("Y"); // Current year
$dagen = cal_days_in_month(CAL_GREGORIAN,$maand,$jaar); // Days in current month

$vorigemaand = date("t", mktime(0,0,0,$maand-1,1,$jaar)); // Days in previous month

$begin = date("N", mktime(0,0,0,$maand,1,$jaar)); // Starting day of current month
$einde = date("N", mktime(0,0,0,$maand,$dagen,$jaar)); // Finishing day of  current month
$vorigestart = $begin - 1; // Days of previous month in calander

$counter = 1;
$volgendeMaandCounter = 1;

if($begin > 5){ $rows = 6; }else {$rows = 5; }

for($i = 1; $i <= $rows; $i++){
    echo '<tr class="week">';
    for($x = 1; $x <= 7; $x++){             

        if(($counter - $begin) < 0){
            $date = (($vorigemaand - $vorigestart) + $counter);
            $class = 'class="blur"';
        }else if(($counter - $begin) >= $dagen){
            $date = ($volgendeMaandCounter);
            $volgendeMaandCounter++;

            $class = 'class="blur"';

        }else {
            $date = ($counter - $begin + 1);
            if($vandaag == $counter - $begin + 1){
                $class = 'class="today"';
            }
        }


        echo '<td '.$class.'><a class="date">'. $date . '</a></td>';

        $counter++;
        $class = '';
    }
    echo '</tr>';


}

?>

Thanks in advance!

Upvotes: 0

Views: 191

Answers (1)

Oscar Lidenbrock
Oscar Lidenbrock

Reputation: 816

try with this code:

setlocale(LC_TIME, 'de_DE', 'deu_deu');
/* print test date string */
echo strftime("%A, %d. %B %Y");

Upvotes: 1

Related Questions