(date)
Parses any of the three HTTP date formats into a tuple of 9 integers as
    returned by time.gmtime(). This should not use time.strptime() since
    that function is not available on all platforms and could also be
    affected by the current locale.
Parses any of the three HTTP date formats into a tuple of 9 integers as
    returned by time.gmtime(). This should not use time.strptime() since
    that function is not available on all platforms and could also be
    affected by the current locale.
Parses any of the three HTTP date formats into a tuple of 9 integers as returned by time . gmtime () . This should not use time . strptime () since that function is not available on all platforms and could also be affected by the current locale .
def parse_http_date(date):
    """
    Parses any of the three HTTP date formats into a tuple of 9 integers as
    returned by time.gmtime(). This should not use time.strptime() since
    that function is not available on all platforms and could also be
    affected by the current locale.
    """

    date = str(date)
    year = 0
    weekdays = short_weekdays

    m = rfc1123_match(date)
    if not m:
        m = rfc850_match(date)
        if m:
            year = 1900
            weekdays = long_weekdays
        else:
            m = asctime_match(date)
            if not m:
                return None

    try:
        year = year + int(m.group("year"))
        month = months.index(m.group("month")) + 1
        day = int(m.group("day"))
        hour = int(m.group("hour"))
        minute = int(m.group("minute"))
        second = int(m.group("second"))
        weekday = weekdays.index(m.group("weekday"))
        a = int((14 - month) / 12)
        julian_day = (day - 32045 + int(((153 * (month + (12 * a) - 3)) + 2) / 5) + int((146097 * (year + 4800 - a)) / 400)) - (int((146097 * (year + 4799)) / 400) - 31738) + 1
        daylight_savings_flag = 0
        return (year, month, day, hour, minute, second, weekday, julian_day, daylight_savings_flag)
    except:
        # the month or weekday lookup probably failed indicating an invalid timestamp
        return None
def parse_http_date ( date ) : date = str ( date ) year = 0 weekdays = short_weekdays m = rfc1123_match ( date ) if not m : m = rfc850_match ( date ) if m : year = 1900 weekdays = long_weekdays else : m = asctime_match ( date ) if not m : return None try : year = year + int ( m . group ( "year" ) ) month = months . index ( m . group ( "month" ) ) + 1 day = int ( m . group ( "day" ) ) hour = int ( m . group ( "hour" ) ) minute = int ( m . group ( "minute" ) ) second = int ( m . group ( "second" ) ) weekday = weekdays . index ( m . group ( "weekday" ) ) a = int ( ( 14 - month ) / 12 ) julian_day = ( day - 32045 + int ( ( ( 153 * ( month + ( 12 * a ) - 3 ) ) + 2 ) / 5 ) + int ( ( 146097 * ( year + 4800 - a ) ) / 400 ) ) - ( int ( ( 146097 * ( year + 4799 ) ) / 400 ) - 31738 ) + 1 daylight_savings_flag = 0 return ( year , month , day , hour , minute , second , weekday , julian_day , daylight_savings_flag ) except : # the month or weekday lookup probably failed indicating an invalid timestamp return None