offset = datetime.timezone(datetime.timedelta(hours=3)
def get_time(offset):
return datetime.datetime.now(offset)
print(get_time(offset))
#output:
#22:45
import datetime
import telebot
offset = datetime.timezone(datetime.timedelta(hours=3))
print(datetime.datetime.now(offset))
bot = telebot.TeleBot("token")
@bot.message_handler(commands=['start'])
def start(message):
bot.send_message(message.chat.id, datetime.datetime.now(offset))
if __name__ == '__main__':
while True:
try:
bot.polling(none_stop=True)
except Exception as e:
time.sleep(15)