I can convert a given date string formatted in YYYY-MM-DD
to a datetime
object using:
from datetime import datetime
dt = datetime.strptime(date_str, '%Y-%m-%d')
However, this uses the current machine's timezone by default.
Is there a way to specify a specific timezone (such as UTC, PST, etc) in the conversion so that the obtained datetime
object is in that timezone.
I am trying to do this in Python 3.4.3.