Python Convert UTC Time to Local Time

preview_player
Показать описание
Python Convert Current UTC Time to Local Time
import datetime
import time
import pytz # pip install pytz
import tzlocal # pip install tzlocal

print "Current Local Time: ", current_local_time

print "Current UTC Time: ", current_utc_time

##UTC Time to Local Time
#cat /etc/timezone
print "local_timezone: ", local_timezone
print "Current UTC Time to Local Time: ", \
Рекомендации по теме
Комментарии
Автор

What is a good way to avoid or to remove the "+05:30" at the end of the local time 2018-01-15 04:03:42.461193+05:30?

peteclark
Автор

Hi! Your example is 2018-01-15 04: 03: 42.461193 + 05:30. Have some way to make +05:30 add up with 04:03? Thanks

lucasaugustofagundes
Автор

how to convert any other time to local?

geirha