首先要将时间中秒后面的.及其以后的部分去掉,否则时间转换函数 currenttime=str((datetime.datetime.today())).split('.',2)[0] str((datetime.datetime.today()).replace(hour=0,minute=0,second=0)).split('.',2)[0] 下面的函数是复制过来的,网上多的是: def timestamp_datetime(value): format = '%Y-%m-%d %H:%M:…