13 lines
358 B
Python
13 lines
358 B
Python
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") |