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.
481896
public function dayToString($day, $abbr = false)
	{
		switch ($day)
		{
			case 0:
				return $abbr ? \Lang::txt('SUN') : \Lang::txt('SUNDAY');
			case 1:
				return $abbr ? \Lang::txt('MON') : \Lang::txt('MONDAY');
			case 2:
				return $abbr ? \Lang::txt('TUE') : \Lang::txt('TUESDAY');
			case 3:
				return $abbr ? \Lang::txt('WED') : \Lang::txt('WEDNESDAY');
			case 4:
				return $abbr ? \Lang::txt('THU') : \Lang::txt('THURSDAY');
			case 5:
				return $abbr ? \Lang::txt('FRI') : \Lang::txt('FRIDAY');
			case 6:
				return $abbr ? \Lang::txt('SAT') : \Lang::txt('SATURDAY');
		}
	}
690472
public static function fromShortName(string $name) : DayOfWeek
    {
        return self::fromNameMap($name, self::$shortNames, __METHOD__);
    }
1165506
private String getStringForDay(int day) {
        if(fDates == null) {
            loadDates();
        }
        for(URelativeString dayItem : fDates) {
            if(dayItem.offset == day) {
                return dayItem.string;
            }
        }
        return null;
    }
583149
public static Integer getDay(Day day)
   {
      Integer result = null;
      if (day != null)
      {
         result = DAY_MAP.get(day);
      }
      return (result);
   }
1012292
public static function getWeek($week = null): string
    {
        $week = $week ? $week : date('w');
        switch ($week) {
            case 'Sunday':
                return Yii::t('yuncms', 'Sunday');
                break;
            case 'Monday':
                return Yii::t('yuncms', 'Monday');
                break;
            case 'Tuesday':
                return Yii::t('yuncms', 'Tuesday');
                break;
            case 'Wednesday':
                return Yii::t('yuncms', 'Wednesday');
                break;
            case 'Thursday':
                return Yii::t('yuncms', 'Thursday');
                break;
            case 'Friday':
                return Yii::t('yuncms', 'Friday');
                break;
            case 'Saturday':
                return Yii::t('yuncms', 'Saturday');
                break;
        }
        return 'N/A';
    }
541884
public function day($value = null)
    {
        if ($value !== null) {
            if ($value > 31 || $value < 1) {
                $this->day = 1;
            } else {
                $this->day = $value;
            }
        }
        return $this->day;
    }
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)
395972
public function get_weekday($year, $month, $day) {
        return intval(date('w', mktime(12, 0, 0, $month, $day, $year)));
    }
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');
    }
704980
public function diffInWeeks(Date $dt = null, $abs = true)
    {
        return (int) ($this->diffInDays($dt, $abs) / static::DAYS_PER_WEEK);
    }
1037047
public function monthToString($month, $abbr = false)
	{
		switch ($month)
		{
			case 1:
				return $abbr ? \Lang::txt('JANUARY_SHORT') : \Lang::txt('JANUARY');
			case 2:
				return $abbr ? \Lang::txt('FEBRUARY_SHORT') : \Lang::txt('FEBRUARY');
			case 3:
				return $abbr ? \Lang::txt('MARCH_SHORT') : \Lang::txt('MARCH');
			case 4:
				return $abbr ? \Lang::txt('APRIL_SHORT') : \Lang::txt('APRIL');
			case 5:
				return $abbr ? \Lang::txt('MAY_SHORT') : \Lang::txt('MAY');
			case 6:
				return $abbr ? \Lang::txt('JUNE_SHORT') : \Lang::txt('JUNE');
			case 7:
				return $abbr ? \Lang::txt('JULY_SHORT') : \Lang::txt('JULY');
			case 8:
				return $abbr ? \Lang::txt('AUGUST_SHORT') : \Lang::txt('AUGUST');
			case 9:
				return $abbr ? \Lang::txt('SEPTEMBER_SHORT') : \Lang::txt('SEPTEMBER');
			case 10:
				return $abbr ? \Lang::txt('OCTOBER_SHORT') : \Lang::txt('OCTOBER');
			case 11:
				return $abbr ? \Lang::txt('NOVEMBER_SHORT') : \Lang::txt('NOVEMBER');
			case 12:
				return $abbr ? \Lang::txt('DECEMBER_SHORT') : \Lang::txt('DECEMBER');
		}
	}
1358343
void formatLocalWeekdayStandalone(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays, int firstDay) {
    if (width > 2) {
      formatWeekday(b, d, width, weekdays);
      return;
    }
    formatWeekdayNumeric(b, d, firstDay);
  }
59262
public function dayname($timestamp = 0)
    {
        $day = (int) date('w', $timestamp);

        return $this->translator->_($this->day[$day]);
    }
193023
public function diffInWeeks($date = null, $absolute = true)
    {
        return (int) ($this->diffInDays($date, $absolute) / static::DAYS_PER_WEEK);
    }
660503
public function daysOfWeek($daysOfWeek)
  {
    // Check for empty, string or no value
    if (empty($daysOfWeek) || is_string($daysOfWeek) === false || strlen($daysOfWeek) < 3) {

      // Return with a null parse
      return null;
    }

    // Separate days of the week by comma
    $daysOfWeek = explode(',', $daysOfWeek);

    // Allowed values
    $allowedValues = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'];

    // Make sure each day of week
    foreach ($daysOfWeek as $dayOfWeek) {

      // Is an allowed value
      if (in_array($dayOfWeek, $allowedValues) === false) {

        // Otherwise return with a null parse
        return null;
      }
    }

    // Return days of the week
    return $daysOfWeek;
  }
989389
public function weekday($value = null)
    {
        $dayOfWeek = ($this->dayOfWeek + 7 - intval($this->getTranslationMessage('first_day_of_week') ?? 0)) % 7;

        return is_null($value) ? $dayOfWeek : $this->addDays($value - $dayOfWeek);
    }
196357
def format_date(date, format)
      date = datetime(date)
        if format.nil? || format.empty? || format == "ordinal"
          date_formatted = ordinalize(date)
        else
          format.gsub!(/%a/, ABBR_DAYNAMES_DE[date.wday])
          format.gsub!(/%A/, DAYNAMES_DE[date.wday])
          format.gsub!(/%b/, ABBR_MONTHNAMES_DE[date.mon])
          format.gsub!(/%B/, MONTHNAMES_DE[date.mon])
          date_formatted = date.strftime(format)
        end
        date_formatted
    end