10 lines
398 B
Python
10 lines
398 B
Python
from datetime import datetime, timedelta
|
|
import calendar
|
|
|
|
def get_last_friday(month_year: str) -> str:
|
|
month, year = map(int, month_year.split('/'))
|
|
last_day = calendar.monthrange(year, month)[1]
|
|
date_obj = datetime(year, month, last_day)
|
|
offset = (date_obj.weekday() - 4) % 7
|
|
last_friday = date_obj - timedelta(days=offset)
|
|
return last_friday.strftime("%d.%m.%Y") |