I need the name of the day in a local (serbian) language.
$date = date_create();
$day = date_format($date,"l");
switch ($day) {
case 'Monday': $day = "PONEDELJAK"; break;
case 'Tuesday': $day = "UTORAK"; break;
case 'Wednesday': $day = "SREDA"; break;
case 'Thursday': $day = "ČETVRTAK"; break;
case 'Friday': $day = "PETAK"; break;
case 'Saturday': $day = "SUBOTA"; break;
case 'Sunday': $day = "NEDELJA"; break;
}
$date = $day . ' - ' . date_format($date,"d. m. Y.");
echo $date;
Result - PETAK - 14. 07. 2017.
So, it works, but I suppose there is a shorter way, probably using setlocale(LC_TIME, 'sr_BA') but I'm not sure where to put it.
Any help?