I have a question based on the conversion of a date and time using the start_time element's Google Calendar API, how could I convert it to a day, month and year of Latin America without more, if you could help me please the datetime: 2021-01-19T09:00:00-05:00 I need the follow example: day/mount/year 15/01/2021 I've been trying and can't find a way to convert properly, please if you could help me.
Use the datetime library:
datetime
import datetime date_str = "2021-01-19T09:00:00-05:00" date_obj = datetime.datetime.strptime(date_str[:10], "%Y-%m-%d").strftime("%d/%m/%Y") print(date_obj)
2.1m questions
2.1m answers
60 comments
57.0k users