import datetime int(time.strftime('%Y%m%d%H%M%S')) nowtime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')