def DateOfLogLine(line):
 m = re.compile('[^[]+\\[(\\d+/[A-Za-z]+/\\d+):[^\\d]*').match(line)
 if (not m):
  return None
 try:
  return datetime.date(*time.strptime(m.group(1), '%d/%b/%Y')[:3])
 except ValueError:
  return None

def DateOfLogLine ( line ) : m = re . compile ( '[^[]+\\[(\\d+/[A-Za-z]+/\\d+):[^\\d]*' ) . match ( line ) if ( not m ) : return None try : return datetime . date ( * time . strptime ( m . group ( 1 ) , '%d/%b/%Y' ) [ : 3 ] ) except ValueError : return None
returns a date object representing the log lines timestamp .