jquery - Exact synatx of Datetime field in POST -


i trying send date_time jquery post our server using mongodb backend , using django_tastypie_mongoengine posting far have tried putting date="2010-11-10t03:07:43" , date="2013-05-21t02:17:55.544000" in jquery failing everytime.

models.py:

class problemdetail(document):     date = datetimefield(default=datetime.datetime.now) 

api.py

class problemdetailresource(resources.mongoengineresource)  class meta:      queryset = problemdetail.objects.all()     resource_name = 'problem'     allowed_methods = ('get', 'post', 'put', 'delete','patch')     authorization = authorization.authorization() 

html page

var date = "2000-11-10t03:07:43"  data = json.stringify({"date":date})  $.ajax({  url: 'http://xyz.in/api/v1/problem/?format=json',  type: 'post',              contenttype: 'application/json',  data: data,  datatype: 'json',  processdata: false,  success: function(data){  alert("done!")  } 

i want know exact syntax of sending date

i got answer:

var date = new date() date = d.getfullyear() + '-' + (d.getmonth()+1) + '-' + d.getdate() + 't' + d.gethours() + ':' + d.getminutes() + ':' +d.getseconds()  settings.py use_tz = true 

the time zone comes in new date() reason error in many development servers. using python django , app deployed in apache


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -