0

I am using the telethon library to making telegram bots. when I using event.date it was printing the time on +00.00 time zone. How can I print time on specific timezone

HelloWord
  • 47
  • 1
  • 8

2 Answers2

2

See python - Convert UTC datetime string to local datetime. Stealing the top answer which uses python-dateutil:

from dateutil import tz
local_datetime = event.date.astimezone(tz.tzlocal())
Lonami
  • 4,396
  • 1
  • 18
  • 29
1
from datetime import datetime
print(datetime.now().isoformat(timespec='minutes'))

have a look in datetime library