Javascript Date toLocaleFormat(pattern)
'use strict';//from w ww. j a va 2s . com Date.prototype.toLocaleFormat = Date.prototype.toLocaleFormat || function (pattern) { return pattern.replace(/%Y/g, this.getFullYear()).replace(/%m/g, (this.getMonth() + 1)).replace(/%d/g, this.getDate()); };