标签:默认 标准 nbsp zone timezone uil __file__ 结果 info
import datetime
print(dir(datetime))输出结果如下:
[‘MAXYEAR‘, ‘MINYEAR‘, ‘__builtins__‘, ‘__cached__‘, ‘__doc__‘, ‘__file__‘, ‘__loader__‘, ‘__name__‘, ‘__package__‘, ‘__spec__‘, ‘date‘, ‘datetime‘, ‘datetime_CAPI‘, ‘time‘, ‘timedelta‘, ‘timezone‘, ‘tzinfo‘]
在这里,我们只看下面这些方法
‘date‘, ‘datetime‘, ‘datetime_CAPI‘, ‘time‘, ‘timedelta‘, ‘timezone‘, ‘tzinfo‘
# print(datetime.time())#datetime.time()里面要传参数,不传的话默认都是00:00:00
# print(datetime.date.today())
# print(datetime.date.fromordinal(123534)) #datetime.date.fromordinal根据参数给的时间戳,返回一个data类型的数据
print(datetime.date.fromtimestamp(1544370390.0430489)) #datetime.date.fromtimestamp 根据参数给的时间戳,返回一个data类型的对象
标签:默认 标准 nbsp zone timezone uil __file__ 结果 info
原文地址:https://www.cnblogs.com/dapan-no1/p/10727276.html