-------------Code -------------------------------------------
function ConvertDateToISO(dtDate)
{
//*************************************************
//Converts Javascript dtDate to ISO 8601 standard for compatibility with SharePoint lists
//Inputs: dtDate = Javascript date format (optional)
//*************************************************
//alert("InISOCOnversion");
var d;
if (dtDate != null) {
//Date value supplied
d = new Date(dtDate);
}
else {
//No date supplied, Create new date object
d = new Date();
}
//Generate ISO 8601 date/time formatted string
var s = "";
//alert(d.getFullYear());
if(d.getFullYear)
{
//alert("FullYear");
s += d.getFullYear() + "-";
}
else
{
//alert("getyear");
var year= d.getYear() + 1900;
s += year + "-";
}
//s += d.getYear() + "-";
s += d.getMonth() + 1 + "-";
s += d.getDate();
s += "T" + d.getHours() + ":";
s += d.getMinutes() + ":";
//Replace the "Z" below with the required
//time zone offset (eg "+10:00" - Australian EST)
s += d.getSeconds() + "Z";
//Return the ISO8601 date string
return s;
}
function ConvertDateToISO(dtDate)
{
//*************************************************
//Converts Javascript dtDate to ISO 8601 standard for compatibility with SharePoint lists
//Inputs: dtDate = Javascript date format (optional)
//*************************************************
//alert("InISOCOnversion");
var d;
if (dtDate != null) {
//Date value supplied
d = new Date(dtDate);
}
else {
//No date supplied, Create new date object
d = new Date();
}
//Generate ISO 8601 date/time formatted string
var s = "";
//alert(d.getFullYear());
if(d.getFullYear)
{
//alert("FullYear");
s += d.getFullYear() + "-";
}
else
{
//alert("getyear");
var year= d.getYear() + 1900;
s += year + "-";
}
//s += d.getYear() + "-";
s += d.getMonth() + 1 + "-";
s += d.getDate();
s += "T" + d.getHours() + ":";
s += d.getMinutes() + ":";
//Replace the "Z" below with the required
//time zone offset (eg "+10:00" - Australian EST)
s += d.getSeconds() + "Z";
//Return the ISO8601 date string
return s;
}
Comments
Post a Comment