I am trying to convert local date time to UTC format but I am unable to convert Please let me know how to get required output using following input
Input : 2008-09-17 10:45:00 PM
Output : 2008-09-17 17:15:00 PM
required output: 1715UTC
from datetime import *
from dateutil import *
from dateutil.tz import tz
utc_zone = tz.gettz('UTC')
local_zone = tz.gettz('Asia/kolkata')
utc_zone = tz.tzutc()
local_zone = tz.tzlocal()
# Convert time string to datetime
local_time = datetime.strptime("2008-09-17 10:45:00 PM", '%Y-%m-%d %I:%M:%S %p')
local_time = local_time.replace(tzinfo=local_zone)
utc_time = local_time.astimezone(utc_zone)
utc_string = utc_time.strftime('%Y-%m-%d %H:%M:%S %p')
print utc_string