PX : code

Download this code


<? 

function  lngdate($timestamp, $mode, $lang)  { 

//
//    Date in multiple languages for PHP3 (c)1998 AUVICOM Technologies 
//    by Frank Dieckmann <frank@auvicom.nl>
// 
//    $mode can be:
//     "F"=juni, "M"=jun, "l"=maandag, "D"=ma,
//    "long"=maandag 1 juni, "Long"=Maandag 1 Juni, "short"=ma 1 jun, "Short"=Ma 1 Jun
//
//    $lang is your language freedom of choice, available now:
//    NL=dutch, UK=english, F=french, DE=German (almost)
//

Switch ($lang)    {
    case "NL":
        //    Dutch Language
            //    Days:
        $ld1="maandag";        $sd1="ma";
        $ld2="dinsdag";        $sd2="di";
        $ld3="woensdag";    $sd3="wo";
        $ld4="donderdag";    $sd4="do";
        $ld5="vrijdag";        $sd5="vr";
        $ld6="zaterdag";    $sd6="za";
        $ld7="zondag";        $sd7="zo";
            //    Months:
        $lm1="januari";        $sm1="jan";
        $lm2="februari";    $sm2="feb";
        $lm3="maart";        $sm3="mrt";
        $lm4="april";        $sm4="apr";
        $lm5="mei";        $sm5="mei";
        $lm6="juni";        $sm6="jun";
        $lm7="juli";        $sm7="jul";
        $lm8="augustus";    $sm8="aug";
        $lm9="september";    $sm9="sep";
        $lm10="oktober";    $sm10="okt";
        $lm11="november";    $sm11="nov";
        $lm12="december";    $sm12="dec";
    break;
    case "F":
        //    French Language
            //    Days:
        $ld1="lundi";        $sd1="lun";
        $ld2="mardi";        $sd2="mar";
        $ld3="mercredi";    $sd3="mer";
        $ld4="jeudi";        $sd4="jeu";
        $ld5="vendredi";    $sd5="ven";
        $ld6="samedi";        $sd6="sam";
        $ld7="dimanche";    $sd7="dim"; 
            //    Months:
        $lm1="janvier";        $sm1="jan";
        $lm2="f&eacute;vrier";    $sm2="f&eacute;v";
        $lm3="mars";        $sm3="mars";
        $lm4="avril";        $sm4="avr";
        $lm5="mai";        $sm5="mai";
        $lm6="juin";        $sm6="juin";
        $lm7="juillet";        $sm7="juil";
        $lm8="ao&ucirc;t";    $sm8="ao&ucirc;t";
        $lm9="septembre";    $sm9="sept";
        $lm10="octobre";    $sm10="oct";
        $lm11="novembre";    $sm11="nov";
        $lm12="d&eacute;cembre";$sm12="d&eacute;c";
    break;
    case "DE":
        //    German Language
            //    Days:
        $ld1="montag";        $sd1="mon";
        $ld2="dinstag";        $sd2="dins";
        $ld3="mittwoch";    $sd3="mitt";
        $ld4="donnerstag";    $sd4="don";
        $ld5="freitag";        $sd5="frei";
        $ld6="samstag";        $sd6="sam";
        $ld7="sonntag";        $sd7="son"; 
            //    Months:
        $lm1="januar";        $sm1="jan";
        $lm2="februar";        $sm2="feb";
        $lm3="march";        $sm3="mar";
        $lm4="april";        $sm4="apr";
        $lm5="mai";        $sm5="mai";
        $lm6="juni";        $sm6="jun";
        $lm7="juli";        $sm7="jul";
        $lm8="august";        $sm8="aug";
        $lm9="september";    $sm9="sep";
        $lm10="october";    $sm10="oct";
        $lm11="november";    $sm11="nov";
        $lm12="dezember";    $sm12="dec";
    break;
    case "UK":
        //    English Language
            //    Days:
        $ld1="monday";        $sd1="mon";
        $ld2="tuesday";        $sd2="tue";
        $ld3="wednesday";    $sd3="wed";
        $ld4="thursday";    $sd4="thu";
        $ld5="friday";        $sd5="fri";
        $ld6="saturday";    $sd6="sat";
        $ld7="sunday";        $sd7="sun"; 
            //    Months:
        $lm1="januari";        $sm1="jan";
        $lm2="februari";    $sm2="feb";
        $lm3="march";        $sm3="mar";
        $lm4="april";        $sm4="apr";
        $lm5="may";        $sm5="may";
        $lm6="june";        $sm6="jun";
        $lm7="july";        $sm7="jul";
        $lm8="august";        $sm8="aug";
        $lm9="september";    $sm9="sep";
        $lm10="october";    $sm10="oct";
        $lm11="november";    $sm11="nov";
        $lm12="december";    $sm12="dec";
    break;

    }

        $result =  ""; 
        $dval   =  date( "w",$timestamp)  -  1; 
        $nval   =  (int)  date( "d",$timestamp); 
        $mval   =  date( "m",$timestamp)  -  1; 
        $day    =  array( "$ld1", "$ld2", "$ld3", "$ld4", "$ld5", "$ld6", "$ld7");
        $sday   =  array( "$sd1", "$sd2", "$sd3", "$sd4", "$sd5", "$sd6", "$sd7");
        $month  =  array( "lm1","$lm2","$lm3","$lm4","$lm5","$lm6",
            "$lm7","$lm8","$lm9","$lm10","$lm11","$lm12");
        $smonth =  array( "sm1","$sm2","$sm3","$sm4","$sm5","$sm6",
            "$sm7","$sm8","$sm9","$sm10","$sm11","$sm12");

        switch  ($mode)  { 
                case  "F": 
                        $result    =  ($month[$mval]); 
                        break;              //  Juni 
                case  "M": 
                        $result    =  ($smonth[$mval]); 
                        break;              //  Jun 
                case  "l": 
                        $result    =  ($day[$dval]); 
                        break;              //  Maandag
                case  "D": 
                        $result    =  ($sday[$dval]); 
                        break;              //  Ma
                case  "Long": 
                        $result    =  ucfirst($day[$dval]). 
                        "  ".$nval.  "  ".ucfirst($month[$mval]); 
                        break;              //  Maandag  30  Juni 
                case  "long":  
                        $result    =  "$day[$dval]  $nval  $month[$mval]"; 
                        break;              //  maandag  30  juni    
                case  "Short": 
                        $result    =  ucfirst($sday[$dval]). 
                        "  $nval  ".ucfirst($smonth[$mval]); 
                        break;          //  Ma  30  Jun 
                default: 
                        $result    =  "$sday[$dval]  $nval  $smonth[$mval]"; 
                                              //  ma  30  jun 
        }      
        return  $result; 


?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.