Загрузить файлы в «m»
This commit is contained in:
parent
564e72c0f0
commit
8f38c0926a
13
m/last_friday_datetime.py
Normal file
13
m/last_friday_datetime.py
Normal file
@ -0,0 +1,13 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
|
||||
def get_last_friday(a: str) -> str:
|
||||
date = datetime.strptime(a, "%m/%Y")
|
||||
next_month = date.replace(month=date.month % 12 + 1, day=1)
|
||||
|
||||
last_day = next_month - timedelta(days=1)
|
||||
|
||||
while last_day.weekday() != 4:
|
||||
last_day -= timedelta(days=1)
|
||||
|
||||
return last_day.strftime("%d.%m.%Y")
|
||||
Loading…
Reference in New Issue
Block a user