python 获取上两周日期 脚本

2022-05-13 10:12:29 浏览数 (1)

日期为上上个星期一到上个星期日

def getfilname(): monday = datetime.date.today() one_day = datetime.timedelta(days=1) ft_day = datetime.timedelta(days=14) while monday.weekday() != 0: monday -= one_day lastsunday = monday - one_day llastmonday = monday - ft_day return ("{}_{}_yunying").format(llastmonday, lastsunday)

0 人点赞