2019-03-22
阅读量:
487
datetime模块常用函数汇总(3)
5. fromtimestamp(sec): - 返回自参数中提到的epoch以来经过的秒数计算的日期。
6. min(): - 返回日期类可以表示的最小日期。
7. max(): - 返回日期类可以表示的最大日期。
# Python code to demonstrate the working of
# fromtimestamp(), min() and max()
# importing built in module datetime
import datetime
from datetime import date
# using fromtimestamp() to calculate date
print ("The calculated date from seconds is : ",end="")
print (date.fromtimestamp(3452435))
# using min() to print minimum representable date
print ("Minimum representable date is : ",end="")
print (date.min)
# using max() to print minimum representable date
print ("Maximum representable date is : ",end="")
print (date.max)
输出:
The calculated date from seconds is : 1970-02-09
Minimum representable date is : 0001-01-01
Maximum representable date is : 9999-12-31






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论