Deutsche Wochentage nach Date-Funktion anzeigen

Dieses PHP-Script gibt deutsche Wochentage aus. Der Eingabewert entspricht der Tagesnummer aus der date-Funktion, wobei der erste Wochentag (Nummer 0) der Sonntag ist.

<?php
/*
    This Software returns german day names by given day number from date function.

    Copyright (C) 2020 Guido Richter / tintenkobold.de

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License [http://www.gnu.org/licenses/] for more details.
*/

function date_day_to_german($day)
{
	$day_string = array();
	$day_string[0] = 'Sonntag';
	$day_string[1] = 'Montag';
	$day_string[2] = 'Dienstag';
	$day_string[3] = 'Mittwoch';
	$day_string[4] = 'Donnerstag';
	$day_string[5] = 'Freitag';
	$day_string[6] = 'Samstag';
	return $day_string[$day];
}

?>

Schreibe einen Kommentar