初识python 之 小时加减
#!/user/bin/env python # -*-coding:utf-8 -*- # author:SimpleSir # create_time:2023/4/26 10:33 import datetime deal_hour = '2023061515' deal_hour_time = datetime.datetime.strptime(deal_hour, "%Y%m%d%H") last_deal_hour_time = deal_hour_time + datetime.timedelta(hours=-1) last_deal_hour = last_deal_hour_time.strftime("%Y%m%d%H") print(last_deal_hour)
结果: 2023061514
世风之狡诈多端,到底忠厚人颠扑不破;
末俗以繁华相尚,终觉冷淡处趣味弥长。
posted on 2023-06-15 15:38 Simple-Sir 阅读(36) 评论(0) 编辑 收藏 举报