From 8f38c0926a5ad9d881be2ceeb24c273a8d3b3391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=93=D0=B2=D0=BE?= =?UTF-8?q?=D0=B7=D0=B4=D0=B5=D0=B2?= Date: Fri, 21 Nov 2025 13:31:45 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?m=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- m/last_friday_datetime.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 m/last_friday_datetime.py diff --git a/m/last_friday_datetime.py b/m/last_friday_datetime.py new file mode 100644 index 0000000..f77b141 --- /dev/null +++ b/m/last_friday_datetime.py @@ -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") \ No newline at end of file