G
G
gonwik2022-04-11 20:14:48
Python
gonwik, 2022-04-11 20:14:48

[telegram-bot-aiogram] Getting today's date using from datetime?

[telegram-bot-aiogram] Getting today's date using from datetime?

Good day. I am writing a telegram bot based on aiogram.
I'm trying to get the date with:

from datetime import datetime 
newdate = datetime.now()  
newdate = newdate.strftime("%d.%m.%Y")


The code is the following:
elif message.text == 'Сегодняшняя дата':
    global msg_1
    msg_1 = await bot.send_message(message.chat.id,text = '<i>✅<code>{NowDate}</code></i>',reply_markup = kb.cancel)
    await form.date.set()


I get in response just the text "{NowDate}", tell me, what's wrong? :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2022-04-11
@gonwik

Well, if the f-string was meant, then f is missing

msg_1 = await bot.send_message(message.chat.id,text = f'✅{NowDate}',reply_markup = kb.cancel)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question