(datestring, precise=False)
return date_with_tz.replace(tzinfo=None)
>>> parse_date_string('2013-01-03T11:27:06.045000Z')
    datetime.datetime(2013, 1, 3, 11, 27, 6)
    >>> parse_date_string('2013-01-03T11:27:06.045000Z', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6, 45000)
    >>> parse_date_string('2013-01-03T11:27:06Z', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6)
    >>> parse_date_string('2013-01-03T11:27:06', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6)
    >>> parse_date_string('2013-01-03T11:27:06+03:00', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6)
>>> parse_date_string('2013-01-03T11:27:06.045000Z')
    datetime.datetime(2013, 1, 3, 11, 27, 6)
    >>> parse_date_string('2013-01-03T11:27:06.045000Z', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6, 45000)
    >>> parse_date_string('2013-01-03T11:27:06Z', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6)
    >>> parse_date_string('2013-01-03T11:27:06', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6)
    >>> parse_date_string('2013-01-03T11:27:06+03:00', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6)
>>> parse_date_string ( 2013 - 01 - 03T11 : 27 : 06 . 045000Z ) datetime . datetime ( 2013 1 3 11 27 6 ) >>> parse_date_string ( 2013 - 01 - 03T11 : 27 : 06 . 045000Z True ) datetime . datetime ( 2013 1 3 11 27 6 45000 ) >>> parse_date_string ( 2013 - 01 - 03T11 : 27 : 06Z True ) datetime . datetime ( 2013 1 3 11 27 6 ) >>> parse_date_string ( 2013 - 01 - 03T11 : 27 : 06 True ) datetime . datetime ( 2013 1 3 11 27 6 ) >>> parse_date_string ( 2013 - 01 - 03T11 : 27 : 06 + 03 : 00 True ) datetime . datetime ( 2013 1 3 11 27 6 )
def parse_date_string(datestring, precise=False):
    """
    >>> parse_date_string('2013-01-03T11:27:06.045000Z')
    datetime.datetime(2013, 1, 3, 11, 27, 6)
    >>> parse_date_string('2013-01-03T11:27:06.045000Z', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6, 45000)
    >>> parse_date_string('2013-01-03T11:27:06Z', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6)
    >>> parse_date_string('2013-01-03T11:27:06', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6)
    >>> parse_date_string('2013-01-03T11:27:06+03:00', True)
    datetime.datetime(2013, 1, 3, 11, 27, 6)
    """
    date_with_tz = parse(datestring)
    if not precise:
        date_with_tz = date_with_tz.replace(microsecond=0)
    # couchdbkit throws away timezones too so while this may not be technically
    # correct, at least it's consistent
    return date_with_tz.replace(tzinfo=None)
def parse_date_string ( datestring , precise = False ) : date_with_tz = parse ( datestring ) if not precise : date_with_tz = date_with_tz . replace ( microsecond = 0 ) # couchdbkit throws away timezones too so while this may not be technically # correct, at least it's consistent return date_with_tz . replace ( tzinfo = None )