@core_helper
def date_str_to_datetime(date_str):
 time_tuple = re.split('[^\\d]+', date_str, maxsplit=5)
 if (len(time_tuple) >= 6):
  m = re.match('(?P<seconds>\\d{2})(\\.(?P<microseconds>\\d{6}))?$', time_tuple[5])
  if (not m):
   raise ValueError(('Unable to parse %s as seconds.microseconds' % time_tuple[5]))
  seconds = int(m.groupdict().get('seconds'))
  microseconds = int(m.groupdict(0).get('microseconds'))
  time_tuple = (time_tuple[:5] + [seconds, microseconds])
 return datetime.datetime(*map(int, time_tuple))

@ core_helper def date_str_to_datetime ( date_str ) : time_tuple = re . split ( '[^\\d]+' , date_str , maxsplit = 5 ) if ( len ( time_tuple ) >= 6 ) : m = re . match ( '(?P<seconds>\\d{2})(\\.(?P<microseconds>\\d{6}))?$' , time_tuple [ 5 ] ) if ( not m ) : raise ValueError ( ( 'Unable to parse %s as seconds.microseconds' % time_tuple [ 5 ] ) ) seconds = int ( m . groupdict ( ) . get ( 'seconds' ) ) microseconds = int ( m . groupdict ( 0 ) . get ( 'microseconds' ) ) time_tuple = ( time_tuple [ : 5 ] + [ seconds , microseconds ] ) return datetime . datetime ( * map ( int , time_tuple ) )
convert iso-like formatted datestring to datetime object .