def day(user_id):
markup = types.InlineKeyboardMarkup(row_width=1)
d = datetime.now()
now_day_1 = d - timedelta(days=d.weekday())
dates = [(now_day_1 + timedelta(days=d)).strftime("%m/%d/%Y") for d in range(7)]
days = ["Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота", "Восскресенье"]
my_days = days[d.weekday() + 1:]
my_days1 = dates[d.weekday() + 1:]
days_month = calendar.monthrange(d.year, d.month)[1]
if len(my_days) > (days_month - d.day):
my_days = my_days[:days_month - d.day]
if len(my_days1) > (days_month - d.day):
my_days1 = my_days1[:days_month - d.day]
for j in my_days1:
for i in my_days:
markup.add(types.InlineKeyboardButton(text=i+j, callback_data=j))
return markup
import time
def day():
month_week = {
'Jan': '01',
'Feb': '02',
'Mar': '03',
'Apr': '04',
'May': '05',
'Jun': '06',
'Jul': '07',
'Aug': '08',
'Sep': '09',
'Oct': '10',
'Nov': '11',
'Dec': '12',
'Mon': 'Понедельник',
'Tue': 'Вторник',
'Wed': 'Среда',
'Thu': 'Четверг',
'Fri': 'Пятница',
'Sat': 'Суббота',
'Sun': 'Воскресенье'
}
time_now = time.time()
i, month_end = 0, None
for x in range(0, 31+1):
date = str(time.ctime(time_now+i)).split()
week, month, day, year = month_week[f"{date[0]}"], month_week[f"{date[1]}"], date[2], date[4]
#День недели, месяц, день, год
if month_end is None:
month_end = month
if month == month_end:
print(f'{week} - {day}/{month}/{year}')
i += 86400
day()