def mkdate(datestr):
    return time.strptime(datestr, '%Y-%m-%d')
parser = argparse.ArgumentParser()
parser.add_argument('xDate', type=mkdate)
args = parser.parse_args()
print(args.xDate)
Pass date to a variable from the script