code: def convertToDate(fmt="%Y-%m-%d"):
          
          def cvt_fn(s,l,t):
              try:
                  return datetime.strptime(t[0], fmt).date()
              except ValueError as ve:
                  raise ParseException(s, l, str(ve))
          return cvt_fn
docs: Helper to create a parse action for converting parsed date string to Python datetime.date
  
          Params -
           - fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``)
  
          Example::
  
              date_expr = pyparsing_common.iso8601_date.copy()
              date_expr.setParseAction(pyparsing_common.convertToDate())
              print(date_expr.parseString("1999-12-31"))
  
          prints::
  
              [datetime.date(1999, 12, 31)]