How do I convert a datetime string in local time to a string in UTC time?
I\'m sure I\'ve done this before, but can\'t find it and SO will hopefull
I've had the most success with python-dateutil:
from dateutil import tz def datetime_to_utc(date): """Returns date in UTC w/o tzinfo""" return date.astimezone(tz.gettz('UTC')).replace(tzinfo=None) if date.tzinfo else date