def date_parser(timestr, parserinfo=None, **kwargs):
 flags = (re.IGNORECASE | re.VERBOSE)
 if re.search(_q_pattern, timestr, flags):
  (y, q) = timestr.replace(':', '').lower().split('q')
  (month, day) = _quarter_to_day[q.upper()]
  year = int(y)
 elif re.search(_m_pattern, timestr, flags):
  (y, m) = timestr.replace(':', '').lower().split('m')
  (month, day) = _month_to_day[m.upper()]
  year = int(y)
  if (_is_leap(y) and (month == 2)):
   day += 1
 elif re.search(_y_pattern, timestr, flags):
  (month, day) = (12, 31)
  year = int(timestr)
 else:
  return pandas_datetools.to_datetime(timestr, **kwargs)
 return datetime.datetime(year, month, day)

def date_parser ( timestr , parserinfo = None , ** kwargs ) : flags = ( re . IGNORECASE | re . VERBOSE ) if re . search ( _q_pattern , timestr , flags ) : ( y , q ) = timestr . replace ( ':' , '' ) . lower ( ) . split ( 'q' ) ( month , day ) = _quarter_to_day [ q . upper ( ) ] year = int ( y ) elif re . search ( _m_pattern , timestr , flags ) : ( y , m ) = timestr . replace ( ':' , '' ) . lower ( ) . split ( 'm' ) ( month , day ) = _month_to_day [ m . upper ( ) ] year = int ( y ) if ( _is_leap ( y ) and ( month == 2 ) ) : day += 1 elif re . search ( _y_pattern , timestr , flags ) : ( month , day ) = ( 12 , 31 ) year = int ( timestr ) else : return pandas_datetools . to_datetime ( timestr , ** kwargs ) return datetime . datetime ( year , month , day )
uses dateutil .