Node.js examples for Date:Serialization
Serialization function for Date datatype
/**/* w w w .java 2 s . com*/ * Serialization function for Date datatype. */ Date.prototype.serialize = function() { return '<dateTime.iso8601>' + this.getFullYear() + ( this.getMonth() < 10 ? '0' : '' ) + this.getMonth() + ( this.getDay() < 10 ? '0' : '' ) + this.getDay() + 'T' + ( this.getHours() < 10 ? '0' : '' ) + this.getHours() + ':' + ( this.getMinutes() < 10 ? '0' : '' ) + this.getMinutes() + ':' + ( this.getMinutes() < 10 ? '0' : '' ) + this.getSeconds() + '</dateTime.iso8601>'; // Phew :-) }