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.
5032
public function dayToString($day, $abbr=false)
  {
    switch ($day)
    {
      case 0:
        return $abbr ? $this->translate('DAY_SUN') : $this->translate('DAY_SUNDAY');
      case 1:
        return $abbr ? $this->translate('DAY_MON') : $this->translate('DAY_MONDAY');
      case 2:
        return $abbr ? $this->translate('DAY_TUE') : $this->translate('DAY_TUESDAY');
      case 3:
        return $abbr ? $this->translate('DAY_WED') : $this->translate('DAY_WEDNESDAY');
      case 4:
        return $abbr ? $this->translate('DAY_THU') : $this->translate('DAY_THURSDAY');
      case 5:
        return $abbr ? $this->translate('DAY_FRI') : $this->translate('DAY_FRIDAY');
      case 6:
        return $abbr ? $this->translate('DAY_SAT') : $this->translate('DAY_SATURDAY');
    }
  }
237264
def weekday_to_str(
    weekday: Union[int, str], *, inverse: bool = False
) -> Union[int, str]:
    
    s = [
        "monday",
        "tuesday",
        "wednesday",
        "thursday",
        "friday",
        "saturday",
        "sunday",
    ]
    if not inverse:
        try:
            return s[weekday]
        except:
            return
    else:
        try:
            return s.index(weekday)
        except:
            return
1066110
void formatLocalWeekday(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays, int firstDay) {
    if (width > 2) {
      formatWeekday(b, d, width, weekdays);
      return;
    }
    if (width == 2) {
      b.append('0');
    }
    formatWeekdayNumeric(b, d, firstDay);
  }
599777
public function weeklyOn($day, $time = '0:0'): self
    {
        $this->dailyAt($time);

        return $this->spliceIntoPosition(5, (string) $day);
    }
195250
public function getWeekDayNamesNarrow($day = null)
    {
        $calendar = $this->getName();
        // gregorian, generic

        $data = array();
        $calendsFallback = array($calendar, 'gregorian', 'generic');
        foreach ($calendsFallback as $calendar) {
            $data = $this->getRepoReader()->getEntityByPath(
                'dates/calendars/calendar[@type="'.$calendar.'"]/days/dayContext[@type="format"]/dayWidth[@type="abbreviated"]/day'
            );

            if ($data) {
                break;
            }
        }

        $dayOfWeeks = array();
        foreach($data as $d) {
            $dayOfWeeks[$d['type']] = $d['value'];
        }

        $return = ($day == null) ? $dayOfWeeks : false;

        $day = (is_string($day)) ? strtolower($day) : $day;

        if (is_string($day) && isset($dayOfWeeks[$day])) {
            $return = $dayOfWeeks[$day];
        } elseif(is_int($day)) {
            // get with index
            $arrayKeys = array_keys($dayOfWeeks);
            $return    = $dayOfWeeks[$arrayKeys[$day]];
        }

        return $return;
    }
491495
public function get_timezone_abbr($display_timezone = false)
	{
		// determine the timezone to switch to
		$display_timezone and $timezone = static::$display_timezone;
		empty($timezone) and $timezone = $this->timezone;

		// Temporarily change timezone when different from default
		if (\Fuel::$timezone != $timezone)
		{
			date_default_timezone_set($timezone);
		}

		// Create output
		$output = date('T');

		// Change timezone back to default if changed previously
		if (\Fuel::$timezone != $timezone)
		{
			date_default_timezone_set(\Fuel::$timezone);
		}

		return $output;
	}
794016
public static function workshopTimeString($arrRow) {
		$str = '';
		//\System::loadLanguageFile('default');
		$arrTimes = array('All' => 'all','A' => 'a','B' => 'b');
		foreach($arrTimes as $caps => $nocaps) {
			if($arrRow['is'.$caps] == 1) {
				if($str != '') $str .= ' / ';
				$str .= $GLOBALS['TL_LANG']['wbgym']['weekdayShort'][$arrRow['weekday_'.$nocaps]] . ', ' . $arrRow['time_'.$nocaps];
				if($nocaps != 'all') {
					$str .= ' ('.$caps.')';
				}
			}
		}
		return $str;
	}
411480
public static function localizeDay(int $day, bool $short = false)
    {
        $date = (new static())
            ->next($day);

        return ucfirst($date->formatLocalized($short ? '%a' : '%A'));
    }
356359
private static function getDayNames($day, $shorten = false, $len = 1, $numeric = false)
    {
        $days = array(
            'sat' => array(1, 'شنبه'),
            'sun' => array(2, 'یکشنبه'),
            'mon' => array(3, 'دوشنبه'),
            'tue' => array(4, 'سه شنبه'),
            'wed' => array(5, 'چهارشنبه'),
            'thu' => array(6, 'پنجشنبه'),
            'fri' => array(7, 'جمعه')
        );

        $day = strtolower( substr( $day, 0, 3 ) );
        $day = $days[$day];

        return $numeric ? $day[0] : ( $shorten ? self::substr($day[1], 0, $len) : $day[1]);
    }
1077963
public static function newDateRepetitionFromString($string)
    {
        $days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
        $regex = "/^(hourly|daily|weekly|monthly|yearly)( on (" . implode('|', $days) . "))?( at (.*))?$/";
        
        $result = preg_match($regex, $string, $timeStringMatches);
        if(1 !== $result) {
            throw new InvalidArgumentException('Inalid date repetition string');
        }

        $repetition = $timeStringMatches[1];
        $day = $timeStringMatches[3];
        $time = array_key_exists(5, $timeStringMatches) ? $timeStringMatches[5] : '0:00';

        switch(true) {
            case $repetition === 'hourly' && $time != '':
                $minute = trim(str_replace('minute', '', $time));
                return new HourlyDateRepetition($minute);
            case $repetition === 'daily' && $time != '':
                return DailyDateRepetition::newFromTimeString($time);
            case $repetition === 'weekly' && $day != '':
                $timeString = trim('this ' . $day . ' ' . $time);
                return WeeklyDateRepetition::newFromTimeString($timeString);
            case $repetition === 'monthly' || $repetition === 'yearly':
                throw new \Exception('Not yet implemented');
        }

        throw new InvalidArgumentException('Inalid date repetition string');
    }
923664
def day_of_week(self, abbr: bool = False) -> str:
        
        key = 'abbr' if abbr else 'name'
        days = self._data['day'].get(key)
        return self.random.choice(days)
193023
public function diffInWeeks($date = null, $absolute = true)
    {
        return (int) ($this->diffInDays($date, $absolute) / static::DAYS_PER_WEEK);
    }
843938
public function getDate($endday = false)
    {
        $date = strtotime($this->getText());
        if ($endday == true) {
            $d = date('Y-m-d', $date);
            $date = strtotime($d . ' 23:59:59');
        }
        return $date;
    }
693930
private function getWeekDays()
    {
        if (empty(self::$weekDays) && ($this->translator instanceof TranslatorInterface)) {
            self::$weekDays = [
                $this->translator->trans('calendar.weekdays.monday', [], 'default'),
                $this->translator->trans('calendar.weekdays.tuesday', [], 'default'),
                $this->translator->trans('calendar.weekdays.wednesday', [], 'default'),
                $this->translator->trans('calendar.weekdays.thursday', [], 'default'),
                $this->translator->trans('calendar.weekdays.friday', [], 'default'),
                $this->translator->trans('calendar.weekdays.saturday', [], 'default'),
                $this->translator->trans('calendar.weekdays.sunday', [], 'default'),
            ];
        }

        return self::$weekDays;
    }
701140
public static int calendarDay2Day(int day) {
        switch (day) {
            case Calendar.SUNDAY:
                return SU;
            case Calendar.MONDAY:
                return MO;
            case Calendar.TUESDAY:
                return TU;
            case Calendar.WEDNESDAY:
                return WE;
            case Calendar.THURSDAY:
                return TH;
            case Calendar.FRIDAY:
                return FR;
            case Calendar.SATURDAY:
                return SA;
            default:
                throw new RuntimeException("bad day of week: " + day);
        }
    }
1017531
public static function frenchToJd($month, $day, $year)
    {
        if ($year <= 0) {
            return 0;
        } else {
            return self::$french_calendar->ymdToJd($year, $month, $day);
        }
    }
543691
public static function fromName(string $name) : DayOfWeek
    {
        return self::fromNameMap($name, self::$fullNames, __METHOD__);
    }