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
Asked
Active
Viewed 745 times
0

Jaindu Charindith
- 77
- 1
- 1
- 8
-
2maybe you should use standard module `datetime` to convert it to other timezone? – furas Feb 09 '21 at 23:42
2 Answers
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

Papop Lekhapanyaporn
- 475
- 5
- 17