I am trying to convert a string to a datetime
format which has the following format
YYYYMMDD:HHMM
As an example:
20200712:1834 which is 2020/07/12 18:34
It is not difficult to extract the information from the string one by one and get year, month, day and the time. But I was wondering if there is a suphisticated way of doing this. For example, I tried the following:
from datetime import datetime
date_time_str = '20200712:1834'
date_time_obj = datetime.strptime(date_time_str, '%y%m%d:%H%M')
Could someone kindly let me know?