I have a date_object.time()
,it's Asia/Taipei
time
date_object.time() = '10:00:00'
And I get the datetime.datetime.now
with timezone Asia/Taipei
current = datetime.datetime.now(pytz.utc)
taipeitime = current.replace(tzinfo=pytz.utc).astimezone(pytz.timezone('Asia/Taipei'))
And then I combine the date_object.time()
and taipeitime
combine = datetime.datetime.combine(taipeitime, date_object.time()) #Asia/Taipei time
And I have to convert the combine
to UTC time
But I get error:
print combine.astimezone(pytz.utc)
ValueError: astimezone() cannot be applied to a naive datetime
Please teach me how to convert this? Thank you