There only is a .toISOString()
method, but that will not use the local timezone. For that, you will need to format the string yourself:
function toLocaleISOString(date) {
function pad(n) { return ("0"+n).substr(-2); }
var day = [date.getFullYear(), pad(date.getMonth()+1), pad(date.getDate())].join("-"),
time = [date.getHours(), date.getMinutes(), date.getSeconds()].map(pad).join(":");
if (date.getMilliseconds())
time += "."+date.getMilliseconds();
var o = date.getTimezoneOffset(),
h = Math.floor(Math.abs(o)/60),
m = Math.abs(o) % 60,
o = o==0 ? "Z" : (o<0 ? "+" : "-") + pad(h) + ":" + pad(m);
return day+"T"+time+o;
}