Answer the question
In order to leave comments, you need to log in
I am writing a telegram bot, but he does not want to convert the time?
I want to convert the message.date format to %H:%M:%S, but somehow it doesn't work. Please tell me here is a sample code
import datetime
import settings
from datetime import datetime as dt
from aiogram import Bot, Dispatcher, executor, types
bot = Bot(token = settings.TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands = ['start'])
async def send_start_commands(message: types.Message):
await message.answer('Ваше имя: ' + str(message.from_user.first_name) + '\nФамилия: ' + str(message.from_user.last_name)
+ '\nВаш ник: ' + str(message.from_user.username) + '\nИ, да, вы написали мне это сообщение ровно в + dt.fromtimestamp(message.date).strftime('%H:%M:%S')')
if __name__ == '__main__':
executor.start_polling(dp, skip_updates = True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question