Python Convert Current Local Time to UTC Time

Published: 18 January 2018
on channel: OSPY
2,886
11

Python How to Convert Current Local Time to UTC Time
import datetime
import time
current_local_time = datetime.datetime.now()
print "Current Local Time: ", current_local_time

current_utc_time = datetime.datetime.utcnow()
print "Current UTC Time: ", current_utc_time

##Local Time to UTC Time
current_local_time_timestamp = current_local_time.strftime("%s")
print "current_local_time_timestamp: ", current_local_time_timestamp

print "Current Local Time to UTC Time: ", datetime.datetime.utcfromtimestamp(float(current_local_time_timestamp))


On this page of the site you can watch the video online Python Convert Current Local Time to UTC Time with a duration of hours minute second in good quality, which was uploaded by the user OSPY 18 January 2018, share the link with friends and acquaintances, this video has already been watched 2,886 times on youtube and it was liked by 11 viewers. Enjoy your viewing!