I know this is old but maybe will be helpful since I got into this situation as well:
What about using make_aware() ?
from datetime import datetime
from django.utils.timezone import make_aware
date="22-05-2018"
aware = make_aware(datetime.strptime(date, '%d-%m-%Y'))
This will use the currently active timezone (activated by timezone.activate
). If no timezone is activated explicitly, it would use the default timezone — TIME_ZONE
specified in settings.py
.