Generate random date object.

        :param start: Minimum value of year.
        :param end: Maximum value of year.
        :return: Formatted date.
505943
def date(self, start: int = 2000, end: int = 2019) -> Date:
        
        year = self.random.randint(start, end)
        month = self.random.randint(1, 12)
        day = self.random.randint(1, monthrange(year, month)[1])
        date_object = date(year, month, day)
        return date_object
798701
public static function randomCharRange( $start, $end )
	{
		if ( count( static::$randomCharMap ) == 0 )
			static::populate();

		return chr( random_int( $start, $end ) );
	}
122962
def _init_date_range(self, start_date=None, end_date=None):
        """"""
        self.end_date = end_date
        self.start_date = start_date
        if self.end_date is None:
            today = now_utc().date()
            end_date = self.event.end_dt.date()
            self.end_date = end_date if end_date < today else today
        if self.start_date is None:
            self.start_date = self.end_date - timedelta(days=ReportBase.default_report_interval)
589569
public static int getPeriodDays(Date start, Date end) {
		try {
			start = FORMAT_DATE_.parse(FORMAT_DATE_.format(start));
			end = FORMAT_DATE_.parse(FORMAT_DATE_.format(end));
			Calendar cal = Calendar.getInstance();
			cal.setTime(start);
			long time1 = cal.getTimeInMillis();
			cal.setTime(end);
			long time2 = cal.getTimeInMillis();
			long between_days = (time2 - time1) / (1000 * 3600 * 24);
			return Integer.parseInt(String.valueOf(between_days));
		} catch (Exception e) {
			throw new KnifeUtilsException(e);
		}
	}
1097481
function(startDate, endDate) {
    var current = new Date(startDate);
    var end = new Date(endDate); 
    var dates = [];

    while(current <= end) {

        var m = current.getMonth() + 1;
        var d = current.getDate();
        var oneDate = [
            current.getFullYear(),
            m < 10 ? "0" + m : m,
            d < 10 ? "0" + d : d].join('-');

        dates.push(oneDate);
        current.setDate(current.getDate() + 1);
    }

    return dates;
}
1273875
def date_range_for_webtrends(cls, start_at=None, end_at=None):
        
        if start_at and end_at:
            start_date = cls.parse_standard_date_string_to_date(
                start_at)
            end_date = cls.parse_standard_date_string_to_date(
                end_at)
            numdays = (end_date - start_date).days + 1
            start_dates = [end_date - timedelta(days=x)
                           for x in reversed(range(0, numdays))]
            date_range = []
            for i, date in enumerate(start_dates):
                query_date = cls.parse_date_for_query(date)
                date_range.append((query_date, query_date))
            return date_range
        else:
            return [("current_day-1", "current_day-1")]
7154
def _init_dates(self):
        
        if self.total_transactions == 0:
            return None
        self.epoch_start = Result.select(Result.epoch).order_by(Result.epoch.asc()).limit(1).get().epoch
        self.epoch_finish = Result.select(Result.epoch).order_by(Result.epoch.desc()).limit(1).get().epoch
        self.start_datetime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(self.epoch_start))
        self.finish_datetime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(self.epoch_finish))
36594
public static SimpleInterval<Date> between(
        Date start,
        Date end
    ) {

        return OLD_DATE_FACTORY.between(start, end);

    }
208495
public static function createYears($start, $end)
    {
        $result = array();

        for ($i = $start; $i < $end + 1; $i++) {
            $result[$i] = $i;
        }

        return $result;
    }
683468
def random(self):
        
        utc_now = datetime.datetime.utcnow()
        return self.valueFromString(utc_now.strftime(self.defaultFormat()))
270309
def daterange(start, end, delta=timedelta(days=1), lower=Interval.CLOSED, upper=Interval.OPEN):
    """"""
    date_interval = Interval(lower=lower, lower_value=start, upper_value=end, upper=upper)
    current = start if start in date_interval else start + delta
    while current in date_interval:
        yield current
        current = current + delta
29314
def year(self, minimum: int = 1990, maximum: int = 2050) -> int:
        
        return self.random.randint(minimum, maximum)
458053
def _days(cls, start, end):
        
        days = []
        # datetime
        start_day, end_day = dt.strptime(start, cls.DATE_FORMAT), dt.strptime(end, cls.DATE_FORMAT)
        delta = end_day - start_day

        for day in range(delta.days+1):
            days.append(start_day + timedelta(days=day))
        return days
1335817
def from_year(cls, year):
        

        first_day = date(year, 1, 1)
        return cls.from_date(first_day, period="year")
816353
def _sanitize_dates(start, end):
    
    if isinstance(start, int):
        # regard int as year
        start = datetime(start, 1, 1)
    start = to_datetime(start)

    if isinstance(end, int):
        end = datetime(end, 1, 1)
    end = to_datetime(end)

    if start is None:
        start = datetime(2015, 1, 1)
    if end is None:
        end = datetime.today()
    if start > end:
        raise ValueError('start must be an earlier date than end')
    return start, end
1055759
def date(self, pattern='%Y-%m-%d', end_datetime=None):
        
        return self.date_time(end_datetime=end_datetime).strftime(pattern)
708690
def daterange_start(value):
    ''''''
    if not value:
        return None
    elif isinstance(value, datetime):
        return value.date()
    elif isinstance(value, date):
        return value

    result = parse_dt(value).date()
    dashes = value.count('-')

    if dashes >= 2:
        return result
    elif dashes == 1:
        # Year/Month only
        return result.replace(day=1)
    else:
        # Year only
        return result.replace(day=1, month=1)