def get_current_week(): monday, sunday = datetime.date.today(), datetime.date.today() one_day = datetime.timedelta(days=1) while monday.weekday() != 0: monday -= one_day while sunday.weekday() != 6: sunday += one_day # return monday, sunday # 返回时间字符串 return datetime.datetime.strftime(monday, "%Y-%m-%d"), datetime.datetime.strftime(sunday, "%Y-%m-%d")
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/213935.html原文链接:https://javaforall.net
