Monday, May 25, 2020

convert Date to milliseconds

Hello everyone I want to convert my Date from string to milliseconds

this is my models.py class 

class mail_item_count_deliveries_perDate(models.Model):
   countDeliveries = models.IntegerField(default=0)
   Date = models.DateTimeField()

this is my views.py 

def jsonDeliv(request):
 
 dataset = mail_item_count_deliveries_perDate.objects.all().values_list('Date','countDeliveries')
 data = list(dataset)
 
 return JsonResponse(data, safe=False)

this is how the data looks like 

[["2020-05-21T00:00:00Z", 5], ["2019-05-21T00:00:00Z", 1], ["2020-04-06T00:00:00Z", 3], ["2020-02-10T00:00:00Z", 2], ["2020-01-23T00:00:00Z", 4],

I want to convert the Date to milliseconds I want to use it in stock highchart , and I don't know how to do it here can you guys help me please 

--
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 django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/de8d3e67-2a68-45be-a9c9-fb06fbb206a6%40googlegroups.com.

No comments:

Post a Comment