python3天数转日期

#!/usr/bin/env python3
# -*- coding:utf-8 -*-

import time
import os
import sys

print()
input_num_value = int(input("请输入转换的天数:"))

time_convert_value = input_num_value * 24 * 60 * 60    #天转秒
time_cur_value = time.time()    #当前日期的秒
time_convert_mes = time_cur_value + time_convert_value     #求秒+当前秒=和秒
time_day = time.gmtime(time_convert_mes)    #转换日期
time_day_format = time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime(time_convert_mes))
print()
print('天数转换后的年月日:   {}'.format(time_day_format))
print()

 

posted @ 2021-07-29 13:42  东方无解  阅读(303)  评论(0编辑  收藏  举报