示例#1
0
def parsedate_to_datetime(data):
    *dtuple, tz = _parsedate_tz(data)
    if tz is None:
        return datetime.datetime(*dtuple[:6])
    return datetime.datetime(*dtuple[:6],
                             tzinfo=datetime.timezone(
                                 datetime.timedelta(seconds=tz)))
示例#2
0
def parsedate_to_datetime(data):
    *dtuple, tz = _parsedate_tz(data)
    if tz is None:
        return (datetime.datetime)(*dtuple[:6])
    else:
        return (datetime.datetime)(*dtuple[:6], **{
            'tzinfo':
            datetime.timezone(datetime.timedelta(seconds=tz))
        })
示例#3
0
def parsedate_to_datetime(data):
    parsed_date_tz = _parsedate_tz(data)
    if parsed_date_tz is None:
        raise ValueError('Invalid date value or format "%s"' % str(data))
    *dtuple, tz = parsed_date_tz
    if tz is None:
        return datetime.datetime(*dtuple[:6])
    return datetime.datetime(*dtuple[:6],
            tzinfo=datetime.timezone(datetime.timedelta(seconds=tz)))
示例#4
0
def parsedate_tz(data):
    if not data:
        return None
    return _parsedate_tz(data)
示例#5
0
def parsedate_tz(data):
    if not data:
        return None
    return _parsedate_tz(data)
示例#6
0
def parsedate_to_datetime(data):
    (*dtuple, tz) = _parsedate_tz(data)
    if tz is None:
        return datetime.datetime(*dtuple[:6])
    return datetime.datetime(tzinfo=datetime.timezone(datetime.timedelta(seconds=tz)), *dtuple[:6])
def parsedate_tz(data):
    return None if not data else _parsedate_tz(data)