I am trying to write a code to extract the date and time of the last email received in my inbox to a text file. Current format of the output from my variable b is '2020-07-18 16:53:10.444000+00:00'
. I want the format to be in this format '%m/%d/%y %H:%M:%S'
. Appreciate of someone could help me.
Also would be great to know what the last 5 digits (+00:00) are? I am trying to understand the default format of [ReceivedTime]
b = str(lastDayMessages[0].ReceivedTime)
b = dt.datetime.strptime(b, '%m/%d/%y %H:%M:%S')
print(b)
Error: raise ValueError("time data %r does not match format %r" % ValueError: time data '2020-07-18 16:53:10.444000+00:00' does not match format '%m/%d/%y %H:%M:%S'