Bind the DateTimeField field with Today’s date using SPServices and jQuery


How to bind the DateTimeField field with today’s date using SPServices and jQuery? I can’t use the default Today to set the column in the Sharepoint UI to use Today’s Date as the default value in my SharePoint 2010 SPList. My date field control name is: Request Received Date

When the newform.aspx is loaded, I need to bind this field with today’s date.

  <script type="text/javascript">  _spBodyOnLoadFunctionNames.push("setRequestEndTime");   // Set the Request End Time to today's date    function setRequestEndTime()  {    var d = new Date();  d = (d.getMonth() + 1).toString()   + "/" + d.getDate().toString()   + "/" + d.getFullYear().toString()  + " " + d.getHours().toString()  + ":" + d.getMinutes().toString()     + ":" + d.getSeconds().toString();  //alert(d);     today = new Date();        todayDay = today.getDate();        todayMon = today.getMonth() + 1;        todayYear = today.getYear();        //alert('setRequestEndTime');        var tags = document.getElementsByTagName('input');        for (var i=0; i < tags.length; i++)      {            //alert(' tags[' + i + '].id=' + tags[i].id);            if(tags[i].id.indexOf('ff2_new') > 0)          {              //alert('HIT tags[' + i + '].id=' + tags[i].id);                tags[i].value = todayMon + "/" + todayDay + "/" +            todayYear;            }        }      }   </script> 

I tried to add the above code refer: (http://sympmarc.com/2009/05/20/pre-filling-column-values-in-a-sharepoint-form/”) in a content editor web part. but I didn’t get the value assigned to the datetime field. Sorry for my JavaScript skills, am unable to get what’s meant by ff2_new.

Update:

  <script type="text/javascript">   var $  j = jQuery.noConflict();   function PreSaveAction()   {     alert("here..........");   var txtDueDate = $  j(":input[title='Due By']").val();   var txtReqstRecvdDate = $  j(":input[title='RequestReceivedDate']").val();  } 

here the requestrecvdate is my today’s date. if i set the todays date value, i am getting “undefined” here. so i am unable to compare the txtduedate with the requestrecvdate. Hence I am trying to bind the today’s date with the requestrecvdate field instead of setting the column-settings–> Today’s Date