Returns a list of weekday names.

    Arguments
    ---------
    first_day : str, default None
        The first day of the week. If not given, 'Monday' is used.

    Returns
    -------
    list
        A list of weekday names.
505281
def weekdays(first_day=None):
    
    if first_day is None:
        first_day = 'Monday'
    ix = _lower_weekdays().index(first_day.lower())
    return _double_weekdays()[ix:ix+7]
883323
def next_weekday(weekday):
    """"""
    ix = WEEKDAYS.index(weekday)
    if ix == len(WEEKDAYS)-1:
        return WEEKDAYS[0]
    return WEEKDAYS[ix+1]
318097
def get_next(weekday, including_today=False):
        
        now = datetime.datetime.now()
        if now.weekday() == weekday.value and including_today:
            delta = datetime.timedelta(days=0)
        elif now.weekday() == weekday.value and not including_today:
            delta = datetime.timedelta(days=7)
        else:
            delta = datetime.timedelta(
                (7 + weekday.value - now.weekday()) % 7
            )  # times delta to next instance
        return Day(now + delta).get_just_date()
326262
def search_weekday(weekday, jd, direction, offset):
    ''''''
    return weekday_before(weekday, jd + (direction * offset))
377723
def pickNthWeekday(year, month, dayofweek, hour, minute, whichweek):
    """"""
    first = datetime.datetime(year=year, month=month, hour=hour, minute=minute,
                              day=1)
    weekdayone = first.replace(day=((dayofweek - first.isoweekday()) % 7 + 1))
    for n in xrange(whichweek - 1, -1, -1):
        dt = weekdayone + n * WEEKS
        if dt.month == month:
            return dt
795770
private Map<String, Integer> parseFirstDays(JsonObject root) {
    JsonObject node = resolve(root, "supplemental", "weekData", "firstDay");
    Map<String, Integer> m = new HashMap<>();
    for (String key : objectKeys(node)) {
      String value = string(node, key);
      m.put(key, NUMERIC_DAYS.get(value));
    }
    return m;
  }
492405
def next_week_day(base_date, weekday):
    
    day_of_week = base_date.weekday()
    end_of_this_week = base_date + timedelta(days=6 - day_of_week)
    day = end_of_this_week + timedelta(days=1)
    while day.weekday() != weekday:
        day = day + timedelta(days=1)
    return day
22789
def weekend_to_monday(dt):
    
    if dt.weekday() == 6:
        return dt + timedelta(1)
    elif dt.weekday() == 5:
        return dt + timedelta(2)
    return dt
742874
def opening_hours(location=None, concise=False):
    
    template_name = 'openinghours/opening_hours_list.html'
    days = []  # [{'hours': '9:00am to 5:00pm', 'name': u'Monday'}, {'hours...

    # Without `location`, choose the first company.
    if location:
        ohrs = OpeningHours.objects.filter(company=location)
    else:
        try:
            Location = utils.get_premises_model()
            ohrs = Location.objects.first().openinghours_set.all()
        except AttributeError:
            raise Exception("You must define some opening hours"
                            " to use the opening hours tags.")

    ohrs.order_by('weekday', 'from_hour')

    for o in ohrs:
        days.append({
            'day_number': o.weekday,
            'name': o.get_weekday_display(),
            'from_hour': o.from_hour,
            'to_hour': o.to_hour,
            'hours': '%s%s to %s%s' % (
                o.from_hour.strftime('%I:%M').lstrip('0'),
                o.from_hour.strftime('%p').lower(),
                o.to_hour.strftime('%I:%M').lstrip('0'),
                o.to_hour.strftime('%p').lower()
            )
        })

    open_days = [o.weekday for o in ohrs]
    for day_number, day_name in WEEKDAYS:
        if day_number not in open_days:
            days.append({
                'day_number': day_number,
                'name': day_name,
                'hours': 'Closed'
            })
    days = sorted(days, key=lambda k: k['day_number'])

    if concise:
        # [{'hours': '9:00am to 5:00pm', 'day_names': u'Monday to Friday'},
        #  {'hours':...
        template_name = 'openinghours/opening_hours_list_concise.html'
        concise_days = []
        current_set = {}
        for day in days:
            if 'hours' not in current_set.keys():
                current_set = {'day_names': [day['name']],
                               'hours': day['hours']}
            elif day['hours'] != current_set['hours']:
                concise_days.append(current_set)
                current_set = {'day_names': [day['name']],
                               'hours': day['hours']}
            else:
                current_set['day_names'].append(day['name'])
        concise_days.append(current_set)

        for day_set in concise_days:
            if len(day_set['day_names']) > 2:
                day_set['day_names'] = '%s to %s' % (day_set['day_names'][0],
                                                     day_set['day_names'][-1])
            elif len(day_set['day_names']) > 1:
                day_set['day_names'] = '%s and %s' % (day_set['day_names'][0],
                                                      day_set['day_names'][-1])
            else:
                day_set['day_names'] = '%s' % day_set['day_names'][0]

        days = concise_days

    template = get_template(template_name)
    return template.render({'days': days})
647443
def find_following_working_day(self, day):
        
        day = cleaned_date(day)

        while day.weekday() in self.get_weekend_days():
            day = day + timedelta(days=1)
        return day
1028370
public static Date getFirstDayFromCurrentWeek(Date d) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(d);        
        cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        return cal.getTime();
    }
1167872
def iso_day_to_weekday(d):
    
    if int(d) == utils.get_now().isoweekday():
        return _("today")
    for w in WEEKDAYS:
        if w[0] == int(d):
            return w[1]
934348
public static Date getWeekDay(Date dt, int weekDay) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(dt);
        if (weekDay == 7) {
            weekDay = 1;
        } else {
            weekDay++;
        }
        cal.set(GregorianCalendar.DAY_OF_WEEK, weekDay);
        return cal.getTime();
    }
1329027
public static function getWeekDays()
    {
        static $weekdays = null;
        if ($weekdays == null) {
            $weekdays   = array();
            for ($i = 0; $i < 7; $i++) {
                $weekdays[$i] = strftime('%A', mktime(0, 0, 0, 1, $i, 2001));
            }
        }
        return $weekdays;
    }
495956
function(opts, day, abbr)
    {
        day += opts.firstDay;
        while (day >= 7) {
            day -= 7;
        }
        return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day];
    }
1053452
def next_weekday_in(weekday_abbreviation, direction, count, distance)
      count = direction.downcase == 'b' ? -count.to_i : count.to_i
      weekday = WEEKDAYS[weekday_abbreviation.downcase]

      case distance.downcase
      when "d"
      when "w"
        (@now + count * 7) + weekday[0] - @now.wday  
      when "m"
        future = @now >> count
        future + weekday[0] - future.wday
      when "y"
        future = @now >> count * 12
        future + weekday[0] - future.wday
      end
    end
523271
def __get_first_tuesday(this_date):
    ''''''
    month_range = calendar.monthrange(this_date.year, this_date.month)
    first_of_month = datetime.datetime(this_date.year, this_date.month, 1)
    first_tuesday_day = (calendar.TUESDAY - month_range[0]) % 7
    first_tuesday = first_of_month + datetime.timedelta(days=first_tuesday_day)
    return first_tuesday