Python 특정 일이 속한 Week 계산
2021. 12. 1. 19:30ㆍ서버 프로그래밍
import datetime
def AddDays(sourceDate, count):
targetDate = sourceDate + datetime.timedelta(days = count)
return targetDate
def GetWeekFirstDate(sourceDate):
temporaryDate = datetime.datetime(sourceDate.year, sourceDate.month, sourceDate.day)
weekDayCount = temporaryDate.weekday()
targetDate = AddDays(temporaryDate, -weekDayCount);
return targetDate
https://icodebroker.tistory.com/6852