Загрузить файлы в «m»

This commit is contained in:
Максим Гвоздев 2025-11-21 13:31:45 +00:00
parent 564e72c0f0
commit 8f38c0926a

13
m/last_friday_datetime.py Normal file
View 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")