PHP Nette - how to display from datetime day of the week
Hello, I am a beginner with the PHP Nette framework and I would like to list the Czech name of the day for articles, which will be determined according to the current date or date of the article. How could this be done? E.g. that 1 is Monday, etc. Thank you
Hi,
it would be possible to list the days of the week in PHP as follows:
and or ugly if branching, for example, directly in the latte as follows:
REPLY
Hi,
it would be possible to list the days of the week in PHP as follows:
public function getTodayDayName()
{
$aj = array("1","2","3","4","5","6","7");
$cz = array("pondělí","úterý","středa","čtvrtek","pátek","sobota","neděle");
$datum = str_replace($aj, $cz, date("N"));
return $datum;
}
and or ugly if branching, for example, directly in the latte as follows:
{var $d = $termin->od->format('w')}
{if $d == '0'}
Neděle
{elseif $d == '1'}
Pondělí
{elseif $d == '2'}
Úterý
{elseif $d == '3'}
Středa
{elseif $d == '4'}
Čtvrtek
{elseif $d == '5'}
Pátek
{elseif $d == '6'}
Sobota
{/if}