1

in my javascript file, I have a function

function saveMyData(event, dayDelta, minuteDelta) {

montitre = event.title;
mondepart = event.start;
mafin = event.end;`

$.getJSON("{% url events_drag %}", {'title': montitre, 'start': mondepart,
 'end': mafin},  function(data) {
 });
 }

if i put a message alert inside the function

alert(mafin);

I display :

Tue Aug 04 2015 16:00:00 GMT+0200

I want to send mafin to a python function with getJSON and read mafin with this code :

def eventsdrag(request):
    end = float(request.GET.get('end'))
    end = datetime.datetime.fromtimestamp(end)

How to convert 'Tue Aug 04 2015 16:00:00 GMT+0200' in a number and read this number with request.GET.get?

doru
  • 9,022
  • 2
  • 33
  • 43
Patrice
  • 209
  • 1
  • 4
  • 15
  • Convert your `mafin` to a timestamp before sending it: http://stackoverflow.com/questions/9873197/convert-date-to-timestamp-in-javascript – Alex Morozov Feb 09 '16 at 12:59
  • https://docs.python.org/2/library/datetime.html#datetime.datetime.strptime – Selcuk Feb 09 '16 at 13:01
  • What have you tried? solutions you'll get on here about how to parse date times in python are the same as you'd get on google. – Sayse Feb 09 '16 at 13:07

0 Answers0