hello django-users hope you are doing well !
I was trying to convert the Date from string to timestamp
def JsonDeliv(request):
dataset = DeliveriesperDate.objects.all().values_list('Date',
'CountDeliveries')
data = list(dataset)
for i in data :
data[i][0] = int(time.mktime(time.strptime(str(i),'%Y-%m-%dT%H:%M:%S.%Z'
))*1000)
return JsonResponse(data, safe=False)
this is the error I get : ValueError: time data '(datetime.datetime(2020,
5, 21, 0, 0, tzinfo=<UTC>), 5)' does not match format '%Y-%m-%dT%H:%M:%S.%Z'
can you guys help me out !
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/121fd489-7fe3-4191-94b6-3ef8b14bf64a%40googlegroups.com.