I am trying to figure out how to make a datetime object aware through using a variable. I grab the timezone of the user and pass it through a form to be used.
I have tried both of the below methods and am not having much success
timezone_variable = "Europe/London"
new_datetime = datetime(int(date_year), int(date_month), int(date_day),
int(time_hour), int(date_minute), tzinfo=timezone_variable)
new_datetime = datetime(int(date_year), int(date_month), int(date_day),
int(time_hour), int(date_minute), tzinfo=timezone.timezone_variable)
This will then give me errors of TypeError: tzinfo argument must be None or of a tzinfo subclass, not type 'str'
The timezone will not always be known upfront, so it would not be possible to simply have the argument be as such tzinfo=timezone.utc
.