Date iterator returning dates in d1 <= x < d2
355115
def iterdays(self, d1, d2):
        
        curr = datetime.datetime.combine(d1, datetime.time())
        end = datetime.datetime.combine(d2, datetime.time())
        if d1.date() == d2.date():
            yield curr
            return
        while curr < end:
            yield curr
            curr = curr + datetime.timedelta(days=1)
530110
def date_elem(ind_days, ind_minutes):
    """"""
    def inner(seq):
        return nexrad_to_datetime(seq[ind_days], seq[ind_minutes] * 60 * 1000)
    return inner
172778
public DateFuncSup subtract(DateSeperator d) {
                date.setTime(date.getTime() - d.parse());
                return this;
        }
15105
def _getFromDate(l, date):
    '''
    
    '''
    try:
        date = _toDate(date)
        i = _insertDateIndex(date, l) - 1
        if i == -1:
            return l[0]
        return l[i]
    except (ValueError, TypeError):
        # ValueError: date invalid / TypeError: date = None
        return l[0]
1212875
def date_in_range(date1, date2, range):
    """"""
    date_obj1 = convert_date(date1)
    date_obj2 = convert_date(date2)
    return (date_obj2 - date_obj1).days <= range
653551
public static function getAge(Date $d1, Date $d2 = null): string
    {
        if ($d2 instanceof self) {
            if ($d2->maximumJulianDay() >= $d1->minimumJulianDay() && $d2->minimumJulianDay() <= $d1->maximumJulianDay()) {
                // Overlapping dates
                $jd = $d1->minimumJulianDay();
            } else {
                // Non-overlapping dates
                $jd = $d2->minimumJulianDay();
            }
        } else {
            // If second date not specified, use today’s date
            $jd = Carbon::now()->julianDay();
        }

        // Just years, in local digits, with warning for negative/
        if ($jd && $d1->minimumJulianDay()) {
            if ($d1->minimumJulianDay() > $jd) {
                return view('icons/warning');
            }

            $years = $d1->minimumDate()->getAge($jd);

            return I18N::number($years);
        }

        return '';
    }
694878
function () {
    let date = new Date();
    let result = {};
    let regex = /(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d).\d\d\dZ/g;
    let current = regex.exec(date.toJSON());
    if (current === null || current.length < 7) {
        return null;
    }
    for (let i = 0; i < 6; i++) {
        //The first element is the full matched string
        result[values[i]] = current[i + 1];
    }
    return result;
}
41975
static Generator byMonthDayGenerator(int[] dates, final DateValue dtStart) {
        final int[] udates = Util.uniquify(dates);

        return new Generator() {
            int year = dtStart.year();
            int month = dtStart.month();
            /** list of generated dates for the current month */
            int[] posDates;
            /** index of next date to return */
            int i = 0;

            {
                convertDatesToAbsolute();
            }

            private void convertDatesToAbsolute() {
                IntSet posDates = new IntSet();
                int nDays = TimeUtils.monthLength(year, month);
                for (int j = 0; j < udates.length; ++j) {
                    int date = udates[j];
                    if (date < 0) {
                        date += nDays + 1;
                    }
                    if (date >= 1 && date <= nDays) {
                        posDates.add(date);
                    }
                }
                this.posDates = posDates.toIntArray();
            }

            @Override
            boolean generate(DTBuilder builder) {
                if (year != builder.year || month != builder.month) {
                    year = builder.year;
                    month = builder.month;

                    convertDatesToAbsolute();

                    i = 0;
                }
                if (i >= posDates.length) {
                    return false;
                }
                builder.day = posDates[i++];
                return true;
            }

            @Override
            public String toString() {
                return "byMonthDayGenerator";
            }
        };
    }
316882
public static function getAgeYears(Date $d1, Date $d2): int
    {
        if (self::compare($d1, $d2) === 0) {
            // Overlapping dates
            $jd = $d1->minimumJulianDay();
        } else {
            // Non-overlapping dates
            $jd = $d2->minimumJulianDay();
        }

        if ($jd && $d1->minimumJulianDay() && $d1->minimumJulianDay() <= $jd) {
            return $d1->minimumDate()->getAge($jd);
        }

        return -1;
    }
605874
function getParsedDate(d, p) {
        var res, day;
        if ('string' === typeof d) {
            d = d === 'today' ? new Date() : new Date(d);
            // If invalid  date it return NaN.
            day = d.getDate();
            if (!day) return false;
        }
        try {
            res = {
                day: day || d.getDate(),
                month: d.getMonth() + 1,
                year: d.getFullYear(),
                obj: d
            };
        }
        catch(e) {
            return false;
        }
        res.str = (p.dayPos ? res.day + p.sep + res.month :
                   res.month + p.sep + res.day) + p.sep;
        res.str += p.yearDigits === 2 ? res.year.substring(3,4) : res.year;
        return res;
    }
1249679
def dateRect( self, date ):
        
        data = self._dateGrid.get(date.toJulianDay())
        if ( data ):
            return QRectF(data[1])
        return QRectF()
214929
def mkIntDate(s):
    
    n = s.__len__()
    d = int(s[-(n - 1):n])

    return d
96427
public static Expression dateDiffStr(String expression1, String expression2, DatePart part) {
        return dateDiffStr(x(expression1), x(expression2), part);
    }
615232
public static int days(EvaluationContext ctx, Object endDate, Object startDate) {
        return datedif(ctx, startDate, endDate, "d");
    }
489584
private static long daysBetween(Date date1, Date date2) {
        long diff;
        if (date2.after(date1)) {
            diff = date2.getTime() - date1.getTime();
        } else {
            diff = date1.getTime() - date2.getTime();
        }
        return diff / (24 * 60 * 60 * 1000);
    }
422864
def dateDict(date, prefix = ""):
    """"""
    res = {}

    res[prefix+"a"] = date.strftime("%a")
    res[prefix+"A"] = date.strftime("%A")
    res[prefix+"b"] = date.strftime("%b")
    res[prefix+"B"] = date.strftime("%B")
    res[prefix+"c"] = date.strftime("%c")
    res[prefix+"d"] = date.strftime("%d")
    res[prefix+"H"] = date.strftime("%H")
    res[prefix+"I"] = date.strftime("%I")
    res[prefix+"j"] = date.strftime("%j")
    res[prefix+"m"] = date.strftime("%m")
    res[prefix+"M"] = date.strftime("%M")
    res[prefix+"p"] = date.strftime("%p")
    res[prefix+"S"] = date.strftime("%S")
    res[prefix+"U"] = date.strftime("%U")
    res[prefix+"w"] = date.strftime("%w")
    res[prefix+"W"] = date.strftime("%W")
    res[prefix+"x"] = date.strftime("%x")
    res[prefix+"X"] = date.strftime("%X")
    res[prefix+"y"] = date.strftime("%y")
    res[prefix+"Y"] = date.strftime("%Y")
    res[prefix+"Z"] = date.strftime("%Z")

    for i, value in res.items():
        res[i] = locale_to_utf8(value)

    return res
1223220
function (date1, date2) {
                return date1.getHours() === date2.getHours() &&
                    date1.getMinutes() === date2.getMinutes();
            }