JSON ISODate MVC Datetime
$().ready(function() {
$('#datepicker').datepicker({
inline: true
});
@RenderSection("jsStartUp",false)
});
Date.prototype.toISOString = function() {
//var date = '"\\\/Date(' + this.getTime() + ')\\\/"';
return toISOString(this);
};
function padzero(n) {
return n < 10 ? '0' + n : n;
}
function pad2zeros(n) {
if (n < 100) {
n = '0' + n;
}
if (n < 10) {
n = '0' + n;
}
return n;
}
function toISOString(d) {
return d.getUTCFullYear() + '-' + padzero(d.getUTCMonth() + 1) + '-' + padzero(d.getUTCDate()) + 'T' + padzero(d.getUTCHours()) + ':' + padzero(d.getUTCMinutes()) + ':' + padzero(d.getUTCSeconds()) + '.' + pad2zeros(d.getUTCMilliseconds()) + 'Z';
}
function parseMSJSONString(data) {
try {
var newdata = data.replace(
new RegExp('"\\\\\/Date\\\((-?[0-9]+)\\\)\\\\\/"', "g"), "new Date($1)");
newdata = eval('(' + newdata + ')');
return newdata;
} catch(e) {
return null;
}
$('#datepicker').datepicker({
inline: true
});
@RenderSection("jsStartUp",false)
});
Date.prototype.toISOString = function() {
//var date = '"\\\/Date(' + this.getTime() + ')\\\/"';
return toISOString(this);
};
function padzero(n) {
return n < 10 ? '0' + n : n;
}
function pad2zeros(n) {
if (n < 100) {
n = '0' + n;
}
if (n < 10) {
n = '0' + n;
}
return n;
}
function toISOString(d) {
return d.getUTCFullYear() + '-' + padzero(d.getUTCMonth() + 1) + '-' + padzero(d.getUTCDate()) + 'T' + padzero(d.getUTCHours()) + ':' + padzero(d.getUTCMinutes()) + ':' + padzero(d.getUTCSeconds()) + '.' + pad2zeros(d.getUTCMilliseconds()) + 'Z';
}
function parseMSJSONString(data) {
try {
var newdata = data.replace(
new RegExp('"\\\\\/Date\\\((-?[0-9]+)\\\)\\\\\/"', "g"), "new Date($1)");
newdata = eval('(' + newdata + ')');
return newdata;
} catch(e) {
return null;
}