Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Need Help Using UpdateListItems

$
0
0
One more point for anyone coming across this useful function, the getYear() will not work with new browsers and has been replaced with getFullYear() so replace that in gkoliver's function or Sharepoint will throw an error when people access via new browsers.

Reviewed code:
Number.prototype.digitise = function (val) 
{
    return (new Array( val + 1 ).join("0") + this ).slice( - val );
}
function ConvertDateToISO(dtDate)
{
//*************************************************//Converts Javascript dtDate to ISO 8601 standard for compatibility with SharePoint lists//Inputs: dtDate = Javascript date format (optional)//*************************************************var d;
  if (dtDate != null)  {
     //Date value supplied
     d = dtDate;
  }
  else  {
     //No date supplied, Create new date object
     d = new Date();
  }
  //Generate ISO 8601 date/time formatted stringvar s = "";
  s += d.getFullYear() + "-";
  s += d.getMonth() + 1 + "-";
  s += d.getDate();
  s += "T" + d.getHours().digitise(2) + ":";
  s += d.getMinutes().digitise(2) + ":";
  //Replace the "Z" below with the required//time zone offset (eg "+10:00" - Australian EST)
  s += d.getSeconds().digitise(2) + "Z";
  //Return the ISO8601 date stringreturn s;
}

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>