@staticmethod<EOL><INDENT>def convertToDate(fmt="<STR_LIT>"):<DEDENT>
def cvt_fn(s,l,t):<EOL><INDENT>try:<EOL><INDENT>return datetime.strptime(t[<NUM_LIT:0>], fmt).date()<EOL><DEDENT>except ValueError as ve:<EOL><INDENT>raise ParseException(s, l, str(ve))<EOL><DEDENT><DEDENT>return cvt_fn<EOL>
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)]