Location: PHPKode > scripts > NLDatum > nldatum/nldatum.php
<?
/*
Rewrite of the germandate class in Dutch.
Original class by Peter Klauer.

The call is at te bottom of this page ...
*/

Class NLDatum {
	Var $Debug = False;
	Var $Maanden = Array('Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December');
	Var $Dagen = Array('Zondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag');
	Var $Formaat = 'D., d. F Y';
	Var $Mktime;

	Function NLDatum($Formaat = '', $Mktime = '' ) {
		If (Strlen($Formaat) > 0) {
			$this->Formaat = $Formaat;
		}
		If (Strlen($Mktime) > 0 ) {
			$this->Mktime = $Mktime;
    }
    Else {
			$this->Mktime = Mktime();
    }
  }

	Function Date($Formaat = '', $Mktime = '') {
		$this->NLDatum($Formaat, $Mktime);
		If($this->Debug) {
			echo '<br><br>$Formaat = '.$this->Formaat.'<br>';
			echo '$Itime  = '.$this->Mktime.'<br>';
		}

    $FDut = Str_replace('D','@1', $this->Formaat);
    $FDut = Str_replace('l','@2', $FDut);
    $FDut = Str_replace('M','@3', $FDut);
    $FDut = Str_replace('F','@4', $FDut);

    #Dag
    $Dag = $this->Dagen[Date('w', $this->Mktime)];
    $Dag3 = $Dag;
    
    #Maand
    $Maand = $this->Maanden[Date('m', $this->Mktime)-1];
    $Maand3= $Maand;
    
    #Dag voluit
    $DutString = Str_replace('@1',$Dag3, date($FDut, $this->Mktime));
    $DutString = Str_replace('@2',$Dag, $DutString);
		
    #Maand voluit
    $DutString = Str_replace('@3',$Maand3, $DutString);
    $DutString = Str_replace('@4',$Maand, $DutString);

    If($this->Debug) {
			echo 'Mask='.Date($FDut, $this->Mktime).'<br>';
      $Origineel = Date($this->Formaat, $this->Mktime);
      echo "Origineel  =$Origineel<br>";
      echo "Nederlandse Strings: $Dag $Dag3 $Maand $Maand3<br>";
      echo "DutString = $DutString<br>";
    }

    Return($DutString);
  }
}

$NLDatum = New NLDatum('D, d M Y');
Echo $NLDatum->Date();
?>
Return current item: NLDatum