def NowTime(df: pd.DataFrame, p=''):
now13 = int(time.time() * 1000)
now = int(now13 / 1000)
now_F = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(now13 / 1000))
now_F_T = time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime(now13 / 1000))
now_F_TZ = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.localtime(now13 / 1000))
resultDF = pd.DataFrame()
print(type(now13))
resultDF.loc[0, 'Now'] = now
resultDF.loc[0, 'Now13'] = now13
resultDF.loc[0, 'Now_F'] = now_F
resultDF.loc[0, 'now_F_T'] = now_F_T
resultDF.loc[0, 'now_F_TZ'] = now_F_TZ
return resultDF
if __name__ == '__main__':
df=pd.DataFrame()
xx=NowTime(df)
print(xx.dtypes)
运行结果
<class 'int'>
Now float64
Now13 float64
Now_F object
now_F_T object
now_F_TZ object
dtype: object