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

2 Answers2

3

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
  • 5,945
  • 2
  • 20
  • 38
1
from datetime import datetime
print(datetime.now().isoformat(timespec='minutes'))

have a look in datetime library