Returns the week view URL for a given date.

    :param date: A date instance.
    :param day: Day number in a month.
978257
def get_week_URL(date, day=0):
    
    if day < 1:
        day = 1
    date = datetime(year=date.year, month=date.month, day=day, tzinfo=utc)
    return reverse('calendar_week', kwargs={'year': date.isocalendar()[0],
                                            'week': date.isocalendar()[1]})
482620
def display_date(d):
    
    stamp = d.strftime('%Y-%m-%d')
    visible_date = d.strftime(app_settings.DATE_FORMAT)

    return format_html('<time datetime="%(stamp)s">%(visible)s</time>' % {
                'stamp': stamp,
                'visible': visible_date
            })
45384
public static Calendar getDateCeil(Date date) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(date);
        return new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
    }
326102
def semantic_date_tag(date, options = {})
      SemanticDateTimeTags::Tag::Date.new(date, options).to_html
    end
916123
function getWeekNumber(date) {
  date = this.toDate(date);
  var week = this._startWeek;
  return date ? getWeekNumberFn(date, week, this.startMonth): null;
}
990179
def get_dates_link(url):
    
    urllib.request.urlretrieve(url, "temp.txt")
    dates = get_dates_file("temp.txt")
    os.remove("temp.txt")
    return dates
1036368
def get_schedule(self, date=None):
        

        schedule_url = self.api_path + "schedule/"
        params = {}
        if date:
            params['date'] = date
        response = self.get_response(schedule_url, params)
        return response
116730
function week(date) {
  var d = new Date(+date);
  var y, w;

  d.setHours(0, 0, 0);
  d.setDate(d.getDate() + 4 - (d.getDay()||7));

  y = new Date(d.getFullYear(), 0, 1);
  w = Math.ceil((((d - y) / DAY_M) + 1) / 7);
  return d.getFullYear() + '-W' + zeroFill(w);
}
1302780
def view(viewname='default', matcher=None,
         config_dir=None, optional_config_files=None, cron_cfg="cron"):
    """"""
    return connect(config_dir, optional_config_files, cron_cfg).view(viewname, matcher)
419290
def get_day_of_week_description(self):
        

        if self._expression_parts[5] == "*" and self._expression_parts[3] != "*":
            # DOM is specified and DOW is * so to prevent contradiction like "on day 1 of the month, every day"
            # we will not specified a DOW description.
            return ""

        def get_day_name(s):
            exp = s
            if "#" in s:
                exp, useless = s.split("#", 2)
            elif "L" in s:
                exp = exp.replace("L", '')
            return self.number_to_day(int(exp))

        def get_format(s):
            if "#" in s:
                day_of_week_of_month = s[s.find("#") + 1:]

                try:
                    day_of_week_of_month_number = int(day_of_week_of_month)
                    choices = {
                        1: _("first"),
                        2: _("second"),
                        3: _("third"),
                        4: _("forth"),
                        5: _("fifth"),
                    }
                    day_of_week_of_month_description = choices.get(day_of_week_of_month_number, '')
                except ValueError:
                    day_of_week_of_month_description = ''

                formated = "{}{}{}".format(_(", on the "),
                                           day_of_week_of_month_description, _(" {0} of the month"))
            elif "L" in s:
                formated = _(", on the last {0} of the month")
            else:
                formated = _(", only on {0}")

            return formated

        return self.get_segment_description(
            self._expression_parts[5],
            _(", every day"),
            lambda s: get_day_name(s),
            lambda s: _(", every {0} days of the week").format(s),
            lambda s: _(", {0} through {1}"),
            lambda s: get_format(s)
        )
78720
def _get_closest_week(self, metric_date):
        
        #find the offset to the closest monday
        days_after_monday = metric_date.isoweekday() - 1

        return metric_date - datetime.timedelta(days=days_after_monday)
268749
def date(date):
    
    date = date.value
    return (datetime.strptime(date[:-5], '%Y-%m-%dT%H:%M:%S')
            if len(date) == 24
            else datetime.strptime(date, '%Y%m%dT%H:%M:%S'))
1130145
def date(ctx, year, month, day):
    
    return _date(conversions.to_integer(year, ctx), conversions.to_integer(month, ctx), conversions.to_integer(day, ctx))
359875
public static Date getDayStartDate(Date date)
   {
      if (date != null)
      {
         Calendar cal = popCalendar(date);
         cal.set(Calendar.HOUR_OF_DAY, 0);
         cal.set(Calendar.MINUTE, 0);
         cal.set(Calendar.SECOND, 0);
         cal.set(Calendar.MILLISECOND, 0);
         date = cal.getTime();
         pushCalendar(cal);
      }
      return (date);
   }
1306817
def offset(self, date, n_days):
        '''
        
        '''
#CONSIDER: raise an exception if a date is not in self
        index = self.index(date) + n_days
        if index < 0:
            index = 0
        if index > len(self) - 1:
            index = len(self) - 1
        return self[index]
781231
def previous_week_day(base_date, weekday):
    
    day = base_date - timedelta(days=1)
    while day.weekday() != weekday:
        day = day - timedelta(days=1)
    return day
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();
    }