Here you can find the source of toISOString()
/* /*from www . j a va2s . c o m*/ * Date.js * This file is part of the PassJS library * This file is licensed under the GNU GPLv3 license * * @author: Nowres RAFID <nowres.rafed@gmail.com> * @version: 0.1.0 */ /** Date Utility functions **/ function OzeroPad(val) { return val < 10 ? '0' + val : '' + val; } /** end Date Utility functions **/ /** Date prototype functions definition **/ //TODO: Handle hour = 24 if(!Date.prototype.toISOString) { Date.prototype.toISOString = function () { //ISO : YYYY-MM-DDTHH:mm:ss.sssZ var YYYY = this.getUTCFullYear(), MM = OzeroPad(this.getUTCMonth() + 1), DD = OzeroPad(this.getUTCDate()), HH = OzeroPad(this.getUTCHours()), mm = OzeroPad(this.getUTCMinutes()), ss = OzeroPad(this.getUTCSeconds()), sss = OzeroPad(this.getUTCMilliseconds()), ISO; ISO = YYYY + '-' + MM + '-' + DD + 'T' + HH + ':' + mm + ':' + ss + '.' + sss + 'Z'; return ISO; }; } //We Override toJSON definition to avoid a problem in IE Date.prototype.toJSON = function () { return this.toISOString(); }; /* Date type definitions **/ if (!Date.now) { Date.now = function() { return new Date().getTime(); } }
Date.prototype.toISODateString = function() { function pad(n){ return n < 10 ? '0' + n : n function pad3(n){ if (n < 10) return '00' + n; if (n < 100) return '0' + n; return n; return this.getUTCFullYear()+'-' + pad(this.getUTCMonth()+1)+'-' + pad(this.getUTCDate())+'T' + pad(this.getUTCHours())+':' + pad(this.getUTCMinutes())+':' + pad(this.getUTCSeconds())+'.' + pad3(this.getUTCMilliseconds())+'Z'
Date.prototype.toISOLocalString = function() { if ( this.toString() === 'Invalid Date' ) { return this.toString(); return new Date( this.getTime() - ( this.getTimezoneOffset() * 60 * 1000 ) ).toISOString() .replace( 'Z', this.getTimezoneOffsetAsTime() ); }; Date.prototype.getTimezoneOffsetAsTime = function() { var offsetMinutesTotal; ...
Date.prototype.toISOLocalString = function() { var offset = {}, pad2 = function( x ) { return ( x < 10 ) ? '0' + x : x; }; if ( this.toString() === 'Invalid Date' ) { return this.toString(); offset.minstotal = this.getTimezoneOffset(); ...
Date.prototype.toISOString = function() { return this.getUTCFullYear() + "-" + ("0" + (this.getUTCMonth() + 1)).substr(-2, 2) + "-" + ("0" + this.getUTCDate()).substr(-2, 2) + "T" + ("0" + this.getUTCHours()).substr(-2, 2) + ":" + ("0" + this.getUTCMinutes()).substr(-2, 2) + ":" + ("0" + this.getUTCSeconds()).substr(-2, 2) + "Z";
Date.prototype.toISOString = function() { return this.getFullYear() + '-' + zpad(this.getMonth() + 1) + '-' + zpad(this.getDate()) + 'T' + zpad(this.getHours()) + ':' + zpad(this.getMinutes());
Date.prototype.toISOString = Date.prototype.toISOString || function() { return this.getUTCFullYear() + "-" + ("0" + this.getUTCMonth() + 1 + "-").slice(-3) + ("0" + this.getUTCDate() + "T").slice(-3) + ("0" + this.getUTCHours() + ":").slice(-3) + ("0" + this.getUTCMinutes() + ":").slice(-3) + ("0" + this.getUTCSeconds() + ".").slice(-3) + ("00" + this.getUTCMilliseconds() + "Z").slice(-4); }; ...
function pad(number) { if (number < 10) { return '0' + number; return number; Date.prototype.toISOString = function(withMilliSeconds) { var ISOString = this.getUTCFullYear() + '-' + pad(this.getUTCMonth() + 1) + ...
Date.prototype.toISOString = function toISOString() { var date = this; function pad(str, len) { var pad = "0000"; str = '' + str; return pad.substr(0, len - str.length) + str var y = date.getUTCFullYear(), m = pad(date.getUTCMonth() + 1, 2), ...
var global = (function () { return this; }).call(null); function pad(number) { if (number < 10) { return '0' + number; return number; Date.prototype.toISOString = function toISOString() { return this.getUTCFullYear() + ...