关于python显示日期函数的信息( 四 )


#如需求是当前时间则去掉函数参数改写为datetime.datetime.now()
threeDayAgo = (now_time - datetime.timedelta(days =30))
# 转换为时间戳
timeStamp =int(time.mktime(threeDayAgo.timetuple()))
# 转换为其他字符串格式
otherStyleTime = threeDayAgo.strftime("%Y-%m-%d")
return otherStyleTime
a = late_time("2019-3-30")
print(a)# 打印2018-02-28
关于python显示日期函数和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

推荐阅读