import datetime def get_other_day(mytime, n): y, m, d = mytime.split("-") theday = datetime.datetime(int(y), int(m), int(d)) delta = datetime.timedelta(days=n) other_day = theday - delta other_day = other_day.strftime('%Y-%m-%d') return other_day other_day = get_other_day("2020-2-25", 2) print(other_day)
获取指定日期前几天
猜你喜欢
转载自www.cnblogs.com/zwq-/p/12363035.html
今日推荐
周排行