Gnani Kim
Gnani Kim

Reputation: 61

time data does not match format. python

I have a date like this:

2022-12-29 11:47:07.444185+00:00

and I'm trying to format it. I tried this but I'm having an error:

utc = datetime.strptime(str(list(Rawdata.objects.filter(
                            id=r).values_list('created_at', flat=True))[0]), '%Y-%m-%d %H:%M:%S.%f %Z')


time data '2022-12-29 11:47:07.444185+00:00' does not match format '%Y-%m-%d %H:%M:%S.%f %Z'

Upvotes: 0

Views: 50

Answers (1)

Adelina
Adelina

Reputation: 11871

Update:

'%Y-%m-%d %H:%M:%S.%f %Z'

into

'%Y-%m-%d %H:%M:%S.%f%z'

More info on formats https://docs.python.org/3/library/time.html#time.strftime

Upvotes: 2

Related Questions