When I run the code, I get this error:
ValueError: time data '2021-10-26T10:15:00.000+04:00' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'
The format seems to be correct, what's the problem? Does anyone had the same problem?
I'm using this method
# Convert 2019-09-03T12:31:03.806+0400 to 2019-09-13 16:30:12
def time_converter(time):
if time is None:
time = ''
else:
time_obj = datetime.strptime(time, '%Y-%m-%dT%H:%M:%S.%f%z')
time = time_obj.strftime('%Y-%m-%d %H:%M:%S')
return time
I just give it time in this format 2021-10-26T10:15:00.000+04:00