PHP code example of venca-x / date-cz

1. Go to this page and download the library: Download venca-x/date-cz library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

venca-x / date-cz example snippets


use VencaX;
//...
protected function beforeRender()
{
    parent::beforeRender();

    $this->template->addFilter('monthNameCZ', function ($dayNumber) {
        $dateCZ = new VencaX\DateCZ();
        return $dateCZ->getMonthName($dayNumber);
    });
    
    $this->template->addFilter('dayNameCZ', function ($dayNumber) {
        $dateCZ = new VencaX\DateCZ();
        return $dateCZ->getDayName($dayNumber);
    });
    
    $this->template->addFilter('dayNameShortCZ', function ($dayNumber) {
        $dateCZ = new VencaX\DateCZ();
        return $dateCZ->getShortDayName($dayNumber);
    });
}


{$dateTime->date|date:'n'|monthNameCZ} (* month name*)

{$dateTime->date|date:'N'|dayNameCZ} (* day name*)

{$dateTime->date|date:'N'|dayNameShortCZ} (* short day name*)

$dateCZ = new VencaX\DateCZ();
echo $dateCZ->monthNameCZ($dateTime->date->format('n')); //month name

echo $dateCZ->dayNameCZ($dateTime->date->format('N')); //day name

echo $dateCZ->dayNameShortCZ($dateTime->date->format('N')); //short day name

//monthNameCZ
echo $dateCZ->monthNameCZ(1); //leden
echo $dateCZ->monthNameCZ(2); //únor
echo $dateCZ->monthNameCZ(3); //březen
echo $dateCZ->monthNameCZ(4); //duben
echo $dateCZ->monthNameCZ(5); //květen
echo $dateCZ->monthNameCZ(6); //červen
echo $dateCZ->monthNameCZ(7); //červenec
echo $dateCZ->monthNameCZ(8); //srpen
echo $dateCZ->monthNameCZ(9); //září
echo $dateCZ->monthNameCZ(10); //říjen
echo $dateCZ->monthNameCZ(11); //listopad
echo $dateCZ->monthNameCZ(12); //prosinec

//dayNameCZ
echo $dateCZ->dayNameCZ(1); //pondělí
echo $dateCZ->dayNameCZ(2); //úterý
echo $dateCZ->dayNameCZ(3); //středa
echo $dateCZ->dayNameCZ(4); //čtvrtek
echo $dateCZ->dayNameCZ(5); //pátek
echo $dateCZ->dayNameCZ(6); //sobota
echo $dateCZ->dayNameCZ(7); //neděle

//dayNameShortCZ
echo $dateCZ->dayNameShortCZ(1); //po
echo $dateCZ->dayNameShortCZ(2); //út
echo $dateCZ->dayNameShortCZ(3); //st
echo $dateCZ->dayNameShortCZ(4); //čt
echo $dateCZ->dayNameShortCZ(5); //pá
echo $dateCZ->dayNameShortCZ(6); //so
echo $dateCZ->dayNameShortCZ(7); //ne