Back to Date class

Method dayToString

public string
dayToString
(mixed $day, mixed $abbr = false)
Translates day of week number to a string.
Parameters
  • int $day The numeric day of the week.
  • bool $abbr Return the abbreviated day string?
Returns
  • string The day of the week.
Since
  • 1.7.0
Class: Date
Project: Joomla

Method dayToString - Source code

/**
 * Translates day of week number to a string.
 *
 * @param   integer  $day   The numeric day of the week.
 * @param   boolean  $abbr  Return the abbreviated day string?
 *
 * @return  string  The day of the week.
 *
 * @since   1.7.0
 */
public function dayToString($day, $abbr = false)
{
    switch ($day) {
        case 0:
            return $abbr ? Text::_('SUN') : Text::_('SUNDAY');
        case 1:
            return $abbr ? Text::_('MON') : Text::_('MONDAY');
        case 2:
            return $abbr ? Text::_('TUE') : Text::_('TUESDAY');
        case 3:
            return $abbr ? Text::_('WED') : Text::_('WEDNESDAY');
        case 4:
            return $abbr ? Text::_('THU') : Text::_('THURSDAY');
        case 5:
            return $abbr ? Text::_('FRI') : Text::_('FRIDAY');
        case 6:
            return $abbr ? Text::_('SAT') : Text::_('SATURDAY');
    }
}